{"id":21073653,"url":"https://github.com/chouffe/sourcegraph","last_synced_at":"2025-03-14T03:21:13.642Z","repository":{"id":148674631,"uuid":"54279112","full_name":"Chouffe/sourcegraph","owner":"Chouffe","description":"Coding challenge Source Graph","archived":false,"fork":false,"pushed_at":"2016-03-19T17:48:10.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-20T22:22:50.958Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Chouffe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-19T17:44:58.000Z","updated_at":"2016-03-19T17:48:11.000Z","dependencies_parsed_at":"2023-05-28T15:30:42.882Z","dependency_job_id":null,"html_url":"https://github.com/Chouffe/sourcegraph","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chouffe%2Fsourcegraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chouffe%2Fsourcegraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chouffe%2Fsourcegraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chouffe%2Fsourcegraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Chouffe","download_url":"https://codeload.github.com/Chouffe/sourcegraph/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243515511,"owners_count":20303258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T19:01:30.521Z","updated_at":"2025-03-14T03:21:13.611Z","avatar_url":"https://github.com/Chouffe.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webserver\n\nSourceGraph Challenge.\n\n## Endpoints\n\nThe main rationale for using a hashmap from names to urls was to be able to have fast lookups on names. A hashmap is an optimal DataStructure forl (O(1) time) lookups (given the load factor is not too high \u003c 75%).\n\n- GET /names/:name\n    - Lookup in a hashmap\n        - O(1) time\n        - O(n) space (to store the hashmap), where n is the number of names stored so far\n\n- PUT /names/:name\n    - Add an entry into the hashmap\n        - O(1) time\n        - O(n) space (to store the hashmap)\n\n- DELETE /names\n    - Deletes the hashmap and creates a fresh new empty one\n        - O(1) time\n        - O(1) space\n\n- POST /annotate\n    - Space: hashmap is stored O(n) + parsed html O(number of html tags)\n    - Time: parsing O(number of html tags) + data lookup O(words in html)\n    - Parses the html string into a tree structure (dom).\n        - time: O(number of html tags)\n        - space: O(number of html tags)\n    - Performs a tree traversal O(number of html tags)\n        - On each textual node (but the children of an \u003ca\u003e tag) performs a lookup (O(1) time) on each word to see if it is in the hashmap, and if it is wraps it with the associated url\n            - time: O(number of words in the html)\n            - space: O(n) hashmap\n\n## Prerequisites\n\nYou will need [Leiningen][] 2.0.0 or above installed.\n\n[leiningen]: https://github.com/technomancy/leiningen\n\n## Running\n\nTo start a web server for the application, run:\n\n\u003e lein repl\n\nLeiningen will fetch the dependencies and install them in the project directory. It can take some time :)\n\nWhen the clojure repl is started, run:\n\n\u003e (-main)\n\nThat will start a web server on port 3001.\n\n## License\n\nCopyright © 2016 Arthur Caillau\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchouffe%2Fsourcegraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchouffe%2Fsourcegraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchouffe%2Fsourcegraph/lists"}