22 | )
23 | }
24 |
25 | export default IndexPopup
26 |
--------------------------------------------------------------------------------
/extension-old/postcss.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('postcss').ProcessOptions}
3 | */
4 | module.exports = {
5 | plugins: {
6 | tailwindcss: {},
7 | autoprefixer: {}
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/extension-old/style.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
--------------------------------------------------------------------------------
/extension-old/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | mode: "jit",
4 | darkMode: "class",
5 | content: ["./**/*.tsx"],
6 | plugins: []
7 | }
8 |
--------------------------------------------------------------------------------
/extension-old/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "plasmo/templates/tsconfig.base",
3 | "exclude": [
4 | "node_modules"
5 | ],
6 | "include": [
7 | ".plasmo/index.d.ts",
8 | "./**/*.ts",
9 | "./**/*.tsx"
10 | ],
11 | "compilerOptions": {
12 | "paths": {
13 | "~*": [
14 | "./*"
15 | ]
16 | },
17 | "baseUrl": "."
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/extract.py:
--------------------------------------------------------------------------------
1 | import os
2 | from typing import Optional
3 |
4 | import dotenv
5 | import together
6 | from pydantic import BaseModel, ValidationError
7 | from tenacity import (retry, stop_after_attempt, wait_random,
8 | wait_random_exponential)
9 |
10 | model = "mistralai/Mixtral-8x7B-Instruct-v0.1"
11 |
12 |
13 | class Person(BaseModel):
14 | school: str
15 | major: str
16 | background: str
17 | name: str
18 | interests: str
19 |
20 |
21 | @retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(5))
22 | def extract_person(name: str, msg: str) -> Person:
23 | print(f"Extracting person: {name}")
24 | prompt = f"""Given the following intro message:
25 |
26 | Name: "{name}"
27 | Message: "{msg}"
28 | Please extract the following properties for this person.
29 | interface Response {{
30 | // If a property is not known, put empty string
31 | school: string; // eg. University of Michigan, University of Waterloo
32 | name: string; // eg. John Doe, Jane Smith
33 | major: string; // eg. Computer Science
34 | background: string; // optimize for embedding search, remove punctuation, keep keywords, remove people's names, only keep relevant information. remove emojis.
35 | interests: string; // optimize for embedding search: remove punctuation, keep keywords, remove other people's names, only keep relevant information
36 | }}
37 |
38 | Please return your answer in the form of a JSON object conforming to the Typescript interface definition ONLY. DO NOT change the format of the JSON object. Make sure to include school, name, major, background, interests. DO NOT include any other information in your response. DO NOT include links. Your response:
39 | """
40 |
41 | for _ in range(5): # Retry up to 5 times
42 | try:
43 | generation = together.Complete.create(
44 | max_tokens=256,
45 | stop=["\n\n"],
46 | temperature=0.5,
47 | top_k=10,
48 | prompt=prompt,
49 | model=model
50 | )
51 |
52 | raw_json = generation['output']['choices'][0]['text']
53 | # Extract the {} from the string
54 | raw_json = raw_json[raw_json.find("{"): raw_json.rfind("}") + 1]
55 |
56 | person = Person.model_validate_json(raw_json)
57 | person.name = name
58 | return person
59 | except ValidationError:
60 | print(f"Validation error, retrying generation: {raw_json}")
61 | continue # If validation error occurs, retry the generation
62 |
63 | raise Exception("Failed to generate valid person after 3 attempts")
64 |
--------------------------------------------------------------------------------
/forms/.gitignore:
--------------------------------------------------------------------------------
1 | *.db
2 | *.py[cod]
3 | .web
4 | __pycache__/
--------------------------------------------------------------------------------
/forms/assets/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/forms/assets/favicon.ico
--------------------------------------------------------------------------------
/forms/forms/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/forms/forms/__init__.py
--------------------------------------------------------------------------------
/forms/forms/forms.py:
--------------------------------------------------------------------------------
1 | from rxconfig import config
2 | import reflex as rx
3 | import json
4 | import os
5 |
6 | class FormState(rx.State):
7 | form_data: dict = {}
8 |
9 | @staticmethod
10 | def handle_submit(form_data: dict):
11 | """Handle the form submit."""
12 | # Save form_data to the class attribute
13 | FormState.form_data = form_data
14 | # Call the function to save data to a JSON file
15 | FormState.save_to_json(form_data)
16 |
17 | @staticmethod
18 | def save_to_json(data: dict):
19 | """Save submitted data to a JSON file."""
20 | json_filename = f"{config.app_name}/submissions.json"
21 | if not os.path.isfile(json_filename):
22 | with open(json_filename, "w") as file:
23 | json.dump([], file) # Create the file with an empty list
24 |
25 | with open(json_filename, "r+") as file:
26 | submissions = json.load(file)
27 | submissions.append(data)
28 | file.seek(0)
29 | file.truncate() # Clear the file before writing the updated submissions list
30 | json.dump(submissions, file, indent=4)
31 |
32 | def form_example():
33 | state = FormState()
34 |
35 | return rx.vstack(
36 | rx.form(
37 | rx.vstack(
38 | rx.input(
39 | placeholder="First Name",
40 | name="first_name",
41 | ),
42 | rx.input(
43 | placeholder="Last Name",
44 | name="last_name",
45 | ),
46 | rx.hstack(
47 | rx.checkbox("Checked", name="check"),
48 | rx.switch("Switched", name="switch"),
49 | ),
50 | rx.button("Submit", type="submit"),
51 | ),
52 | on_submit=lambda form_data: state.handle_submit(form_data),
53 | reset_on_submit=True,
54 | ),
55 | rx.divider(),
56 | rx.heading("Results"),
57 | # Since form_data is a dictionary, we need to properly format it for display
58 | rx.text(json.dumps(FormState.form_data, indent=2)),
59 | )
60 |
61 | app = rx.App()
62 | app.add_page(form_example)
--------------------------------------------------------------------------------
/forms/forms/submissions.json:
--------------------------------------------------------------------------------
1 | [
2 |
--------------------------------------------------------------------------------
/forms/requirements.txt:
--------------------------------------------------------------------------------
1 | reflex==0.4.0
2 |
--------------------------------------------------------------------------------
/forms/rxconfig.py:
--------------------------------------------------------------------------------
1 | import reflex as rx
2 |
3 | config = rx.Config(
4 | app_name="forms",
5 | )
--------------------------------------------------------------------------------
/graph/.gitignore:
--------------------------------------------------------------------------------
1 | bundle.js
2 | .vercel
3 |
--------------------------------------------------------------------------------
/graph/bun.lockb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/bun.lockb
--------------------------------------------------------------------------------
/graph/data.js:
--------------------------------------------------------------------------------
1 | const nodes = [
2 | {
3 | id: "1",
4 | data: {
5 | name: "John Doe",
6 | interests: ["AI", "Blockchain"],
7 | school: "University of Waterloo",
8 | },
9 | },
10 | {
11 | id: "2",
12 | data: {
13 | name: "Jane Doe",
14 | interests: ["Backend"],
15 | school: "Stanford University",
16 | },
17 | },
18 | {
19 | id: "3",
20 | data: {
21 | name: "James Doe",
22 | interests: ["iOS", "Frontend"],
23 | school: "MIT",
24 | },
25 | },
26 | {
27 | id: "4",
28 | data: {
29 | name: "Jill Doe",
30 | interests: ["Design", "Entrepreneurship"],
31 | school: "UC Berkeley",
32 | },
33 | },
34 | {
35 | id: "5",
36 | data: {
37 | name: "Jack Doe",
38 | interests: ["Data Science"],
39 | school: "Stanford University",
40 | },
41 | },
42 | {
43 | id: "6",
44 | data: {
45 | name: "Jenny Doe",
46 | interests: ["Design", "Frontend"],
47 | school: "University of Waterloo",
48 | },
49 | },
50 | {
51 | id: "7",
52 | data: {
53 | name: "Jared Doe",
54 | interests: ["Backend", "Blockchain"],
55 | school: "UC Berkeley",
56 | },
57 | },
58 | {
59 | id: "8",
60 | data: {
61 | name: "Jasmine Doe",
62 | interests: ["iOS", "Data Science"],
63 | school: "MIT",
64 | },
65 | },
66 | {
67 | id: "9",
68 | data: {
69 | name: "Jasper Doe",
70 | interests: ["AI", "Entrepreneurship"],
71 | school: "University of Waterloo",
72 | },
73 | },
74 | ];
75 |
76 | const links = [
77 | { source: "1", target: "2" },
78 | { source: "1", target: "3" },
79 | { source: "1", target: "4" },
80 | { source: "1", target: "5" },
81 | { source: "1", target: "6" },
82 | { source: "1", target: "7" },
83 | { source: "1", target: "8" },
84 | { source: "1", target: "9" },
85 | ];
86 |
87 | module.exports = {
88 | nodes,
89 | links,
90 | };
91 |
--------------------------------------------------------------------------------
/graph/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/favicon.ico
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMono-Black.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMono-Black.otf
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMono-Black.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMono-Black.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMono-Bold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMono-Bold.otf
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMono-Bold.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMono-Bold.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMono-Light.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMono-Light.otf
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMono-Light.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMono-Light.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMono-Medium.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMono-Medium.otf
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMono-Medium.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMono-Medium.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMono-Regular.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMono-Regular.otf
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMono-Regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMono-Regular.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMono-SemiBold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMono-SemiBold.otf
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMono-SemiBold.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMono-SemiBold.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMono-Thin.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMono-Thin.otf
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMono-Thin.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMono-Thin.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMono-UltraBlack.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMono-UltraBlack.otf
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMono-UltraBlack.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMono-UltraBlack.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMono-UltraLight.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMono-UltraLight.otf
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMono-UltraLight.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMono-UltraLight.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMonoVariableVF.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMonoVariableVF.ttf
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/GeistMonoVariableVF.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist.Mono/GeistMonoVariableVF.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist.Mono/LICENSE.TXT:
--------------------------------------------------------------------------------
1 | Geist Sans and Geist Mono Font
2 | (C) 2023 Vercel, made in collaboration with basement.studio
3 |
4 | This Font Software is licensed under the SIL Open Font License, Version 1.1.
5 | This license is available with a FAQ at: http://scripts.sil.org/OFL and copied below
6 |
7 | -----------------------------------------------------------
8 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
9 | -----------------------------------------------------------
10 |
11 | PREAMBLE
12 | The goals of the Open Font License (OFL) are to stimulate worldwide
13 | development of collaborative font projects, to support the font creation
14 | efforts of academic and linguistic communities, and to provide a free and
15 | open framework in which fonts may be shared and improved in partnership
16 | with others.
17 |
18 | The OFL allows the licensed fonts to be used, studied, modified and
19 | redistributed freely as long as they are not sold by themselves. The
20 | fonts, including any derivative works, can be bundled, embedded,
21 | redistributed and/or sold with any software provided that any reserved
22 | names are not used by derivative works. The fonts and derivatives,
23 | however, cannot be released under any other type of license. The
24 | requirement for fonts to remain under this license does not apply
25 | to any document created using the fonts or their derivatives.
26 |
27 | DEFINITIONS
28 | "Font Software" refers to the set of files released by the Copyright
29 | Holder(s) under this license and clearly marked as such. This may
30 | include source files, build scripts and documentation.
31 |
32 | "Reserved Font Name" refers to any names specified as such after the
33 | copyright statement(s).
34 |
35 | "Original Version" refers to the collection of Font Software components as
36 | distributed by the Copyright Holder(s).
37 |
38 | "Modified Version" refers to any derivative made by adding to, deleting,
39 | or substituting -- in part or in whole -- any of the components of the
40 | Original Version, by changing formats or by porting the Font Software to a
41 | new environment.
42 |
43 | "Author" refers to any designer, engineer, programmer, technical
44 | writer or other person who contributed to the Font Software.
45 |
46 | PERMISSION AND CONDITIONS
47 | Permission is hereby granted, free of charge, to any person obtaining
48 | a copy of the Font Software, to use, study, copy, merge, embed, modify,
49 | redistribute, and sell modified and unmodified copies of the Font
50 | Software, subject to the following conditions:
51 |
52 | 1) Neither the Font Software nor any of its individual components,
53 | in Original or Modified Versions, may be sold by itself.
54 |
55 | 2) Original or Modified Versions of the Font Software may be bundled,
56 | redistributed and/or sold with any software, provided that each copy
57 | contains the above copyright notice and this license. These can be
58 | included either as stand-alone text files, human-readable headers or
59 | in the appropriate machine-readable metadata fields within text or
60 | binary files as long as those fields can be easily viewed by the user.
61 |
62 | 3) No Modified Version of the Font Software may use the Reserved Font
63 | Name(s) unless explicit written permission is granted by the corresponding
64 | Copyright Holder. This restriction only applies to the primary font name as
65 | presented to the users.
66 |
67 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
68 | Software shall not be used to promote, endorse or advertise any
69 | Modified Version, except to acknowledge the contribution(s) of the
70 | Copyright Holder(s) and the Author(s) or with their explicit written
71 | permission.
72 |
73 | 5) The Font Software, modified or unmodified, in part or in whole,
74 | must be distributed entirely under this license, and must not be
75 | distributed under any other license. The requirement for fonts to
76 | remain under this license does not apply to any document created
77 | using the Font Software.
78 |
79 | TERMINATION
80 | This license becomes null and void if any of the above conditions are
81 | not met.
82 |
83 | DISCLAIMER
84 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
85 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
86 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
87 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
88 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
89 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
90 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
91 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
92 | OTHER DEALINGS IN THE FONT SOFTWARE.
93 |
--------------------------------------------------------------------------------
/graph/fonts/Geist/Geist-Black.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/Geist-Black.otf
--------------------------------------------------------------------------------
/graph/fonts/Geist/Geist-Black.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/Geist-Black.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist/Geist-Bold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/Geist-Bold.otf
--------------------------------------------------------------------------------
/graph/fonts/Geist/Geist-Bold.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/Geist-Bold.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist/Geist-Light.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/Geist-Light.otf
--------------------------------------------------------------------------------
/graph/fonts/Geist/Geist-Light.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/Geist-Light.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist/Geist-Medium.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/Geist-Medium.otf
--------------------------------------------------------------------------------
/graph/fonts/Geist/Geist-Medium.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/Geist-Medium.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist/Geist-Regular.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/Geist-Regular.otf
--------------------------------------------------------------------------------
/graph/fonts/Geist/Geist-Regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/Geist-Regular.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist/Geist-SemiBold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/Geist-SemiBold.otf
--------------------------------------------------------------------------------
/graph/fonts/Geist/Geist-SemiBold.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/Geist-SemiBold.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist/Geist-Thin.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/Geist-Thin.otf
--------------------------------------------------------------------------------
/graph/fonts/Geist/Geist-Thin.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/Geist-Thin.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist/Geist-UltraBlack.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/Geist-UltraBlack.otf
--------------------------------------------------------------------------------
/graph/fonts/Geist/Geist-UltraBlack.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/Geist-UltraBlack.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist/Geist-UltraLight.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/Geist-UltraLight.otf
--------------------------------------------------------------------------------
/graph/fonts/Geist/Geist-UltraLight.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/Geist-UltraLight.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist/GeistVariableVF.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/GeistVariableVF.ttf
--------------------------------------------------------------------------------
/graph/fonts/Geist/GeistVariableVF.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freeman-jiang/nexus/f00062a018d0e7d3eea219823c738bf692137747/graph/fonts/Geist/GeistVariableVF.woff2
--------------------------------------------------------------------------------
/graph/fonts/Geist/LICENSE.TXT:
--------------------------------------------------------------------------------
1 | Geist Sans and Geist Mono Font
2 | (C) 2023 Vercel, made in collaboration with basement.studio
3 |
4 | This Font Software is licensed under the SIL Open Font License, Version 1.1.
5 | This license is available with a FAQ at: http://scripts.sil.org/OFL and copied below
6 |
7 | -----------------------------------------------------------
8 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
9 | -----------------------------------------------------------
10 |
11 | PREAMBLE
12 | The goals of the Open Font License (OFL) are to stimulate worldwide
13 | development of collaborative font projects, to support the font creation
14 | efforts of academic and linguistic communities, and to provide a free and
15 | open framework in which fonts may be shared and improved in partnership
16 | with others.
17 |
18 | The OFL allows the licensed fonts to be used, studied, modified and
19 | redistributed freely as long as they are not sold by themselves. The
20 | fonts, including any derivative works, can be bundled, embedded,
21 | redistributed and/or sold with any software provided that any reserved
22 | names are not used by derivative works. The fonts and derivatives,
23 | however, cannot be released under any other type of license. The
24 | requirement for fonts to remain under this license does not apply
25 | to any document created using the fonts or their derivatives.
26 |
27 | DEFINITIONS
28 | "Font Software" refers to the set of files released by the Copyright
29 | Holder(s) under this license and clearly marked as such. This may
30 | include source files, build scripts and documentation.
31 |
32 | "Reserved Font Name" refers to any names specified as such after the
33 | copyright statement(s).
34 |
35 | "Original Version" refers to the collection of Font Software components as
36 | distributed by the Copyright Holder(s).
37 |
38 | "Modified Version" refers to any derivative made by adding to, deleting,
39 | or substituting -- in part or in whole -- any of the components of the
40 | Original Version, by changing formats or by porting the Font Software to a
41 | new environment.
42 |
43 | "Author" refers to any designer, engineer, programmer, technical
44 | writer or other person who contributed to the Font Software.
45 |
46 | PERMISSION AND CONDITIONS
47 | Permission is hereby granted, free of charge, to any person obtaining
48 | a copy of the Font Software, to use, study, copy, merge, embed, modify,
49 | redistribute, and sell modified and unmodified copies of the Font
50 | Software, subject to the following conditions:
51 |
52 | 1) Neither the Font Software nor any of its individual components,
53 | in Original or Modified Versions, may be sold by itself.
54 |
55 | 2) Original or Modified Versions of the Font Software may be bundled,
56 | redistributed and/or sold with any software, provided that each copy
57 | contains the above copyright notice and this license. These can be
58 | included either as stand-alone text files, human-readable headers or
59 | in the appropriate machine-readable metadata fields within text or
60 | binary files as long as those fields can be easily viewed by the user.
61 |
62 | 3) No Modified Version of the Font Software may use the Reserved Font
63 | Name(s) unless explicit written permission is granted by the corresponding
64 | Copyright Holder. This restriction only applies to the primary font name as
65 | presented to the users.
66 |
67 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
68 | Software shall not be used to promote, endorse or advertise any
69 | Modified Version, except to acknowledge the contribution(s) of the
70 | Copyright Holder(s) and the Author(s) or with their explicit written
71 | permission.
72 |
73 | 5) The Font Software, modified or unmodified, in part or in whole,
74 | must be distributed entirely under this license, and must not be
75 | distributed under any other license. The requirement for fonts to
76 | remain under this license does not apply to any document created
77 | using the Font Software.
78 |
79 | TERMINATION
80 | This license becomes null and void if any of the above conditions are
81 | not met.
82 |
83 | DISCLAIMER
84 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
85 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
86 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
87 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
88 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
89 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
90 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
91 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
92 | OTHER DEALINGS IN THE FONT SOFTWARE.
93 |
--------------------------------------------------------------------------------
/graph/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Nexus
5 |
6 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/graph/index.js:
--------------------------------------------------------------------------------
1 | const NODE_COLOR = 0x059669;
2 | const NODE_SIZE = 15;
3 | const NODE_HOVER_COLOR = 0xffe213;
4 | const NODE_CONNECTION_COLOR = 0xe37622;
5 | const LINK_FROM_COLOR = 0x732196;
6 | const LINK_TO_COLOR = 0x82a8f5;
7 | const LINK_CONNECTION_FROM_COLOR = 0xffffff;
8 | const LINK_CONNECTION_TO_COLOR = 0xffe213;
9 | const SPRING_LENGTH = 110;
10 | const SPRING_COEFF = 0.00111;
11 | const GRAVITY = -42;
12 | const THETA = 0.8;
13 | const DRAG_COEFF = 0.154;
14 | const TIME_STEP = 2;
15 |
16 | var createSettingsView = require("config.pixel");
17 | var query = require("query-string").parse(window.location.search.substring(1));
18 | const json = query.treehacks
19 | ? require("./treehacksData.json")
20 | : require("./graphData.json");
21 | var graph = getGraphFromQueryString(query);
22 | var renderGraph = require("ngraph.pixel");
23 | // var addCurrentNodeSettings = require("./nodeSettings.js");
24 | var THREE = require("three");
25 | var createLayout = require("pixel.layout");
26 |
27 | const layout = createLayout(graph);
28 |
29 | var renderer = renderGraph(graph, {
30 | node: () => {
31 | return {
32 | color: NODE_COLOR,
33 | size: NODE_SIZE,
34 | };
35 | },
36 | link: () => {
37 | return {
38 | fromColor: LINK_FROM_COLOR,
39 | toColor: LINK_TO_COLOR,
40 | };
41 | },
42 | });
43 |
44 | var simulator = renderer.layout().simulator;
45 | simulator.springLength(SPRING_LENGTH);
46 | simulator.springCoeff(SPRING_COEFF);
47 | simulator.gravity(GRAVITY);
48 | simulator.theta(THETA);
49 | simulator.dragCoeff(DRAG_COEFF);
50 | simulator.timeStep(TIME_STEP);
51 | renderer.focus();
52 |
53 | // var settingsView = createSettingsView(renderer);
54 | // var gui = settingsView.gui();
55 |
56 | // var nodeSettings = addCurrentNodeSettings(gui, renderer);
57 |
58 | renderer.on("nodehover", showNodeDetails);
59 | renderer.on("nodeclick", resetNodeDetails);
60 |
61 | function showNodeDetails(node) {
62 | if (!node) return;
63 |
64 | // nodeSettings.setUI(node);
65 | resetNodeDetails();
66 |
67 | var nodeUI = renderer.getNode(node.id);
68 | nodeUI.color = NODE_HOVER_COLOR;
69 |
70 | if (graph.getLinks(node.id)) {
71 | graph.getLinks(node.id).forEach(function (link) {
72 | var toNode = link.toId === node.id ? link.fromId : link.toId;
73 | var toNodeUI = renderer.getNode(toNode);
74 | toNodeUI.color = NODE_CONNECTION_COLOR;
75 |
76 | var linkUI = renderer.getLink(link.id);
77 | linkUI.fromColor = LINK_CONNECTION_FROM_COLOR;
78 | linkUI.toColor = LINK_CONNECTION_TO_COLOR;
79 | });
80 | }
81 | showNodePanel(node);
82 | }
83 |
84 | function resetNodeDetails() {
85 | graph.forEachNode(function (node) {
86 | var nodeUI = renderer.getNode(node.id);
87 | nodeUI.color = NODE_COLOR;
88 | });
89 | graph.forEachLink(function (link) {
90 | var linkUI = renderer.getLink(link.id);
91 | linkUI.fromColor = LINK_FROM_COLOR;
92 | linkUI.toColor = LINK_TO_COLOR;
93 | });
94 |
95 | if (document.getElementById("nodePanel")) {
96 | document.getElementById("nodePanel").remove();
97 | }
98 |
99 | showInitialNodePanel();
100 | }
101 |
102 | function getGraphFromQueryString(query) {
103 | var graphGenerators = require("ngraph.generators");
104 | var createGraph = graphGenerators[query.graph] || graphGenerators.grid;
105 | return query.graph
106 | ? createGraph(getNumber(query.n), getNumber(query.m), getNumber(query.k))
107 | : populateGraph();
108 | }
109 |
110 | function getNumber(string, defaultValue) {
111 | var number = parseFloat(string);
112 | return typeof number === "number" && !isNaN(number)
113 | ? number
114 | : defaultValue || 10;
115 | }
116 |
117 | function populateGraph() {
118 | var createGraph = require("ngraph.graph");
119 | var g = createGraph();
120 |
121 | // Extract the "nodes" and "links" from the JSON file
122 | var nodes = json.nodes;
123 | var links = json.links;
124 |
125 | nodes.forEach(function (node) {
126 | g.addNode(node.id, node.data);
127 | });
128 | links.forEach(function (link) {
129 | g.addLink(link.source, link.target);
130 | });
131 |
132 | return g;
133 | }
134 |
135 | function showNodePanel(node) {
136 | if (document.getElementById("nodePanel")) {
137 | document.getElementById("nodePanel").remove();
138 | }
139 | var panel = document.createElement("div");
140 | panel.style.position = "absolute";
141 | panel.style.top = "0";
142 | panel.style.left = "0";
143 | panel.style.color = "white";
144 | panel.style.padding = "10px";
145 | panel.style.marginLeft = "20px";
146 | panel.style.width = "300px";
147 | panel.style.fontFamily = "Geist, sans-serif";
148 | panel.style.maxHeight = "65%";
149 | // panel.style.overflowY = "auto";
150 | panel.id = "nodePanel";
151 | panel.innerHTML = "