Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/misc/quadtree/js/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
6 changes: 6 additions & 0 deletions src/misc/quadtree/js/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This codebase is borrowed from the amazing youtube series by [@CodingTrain](https://github.com/CodingTrain), in particular the following two video:

* [Coding Challenge #98.1: Quadtree - Part 1](https://youtu.be/OJxEcs0w_kE?si=DGXStSVgSsduHaS_)
* [Coding Challenge #98.2: Quadtree - Part 2](https://youtu.be/QQx_NmCIuCY?si=lCtmHQtByl16Vwgk)

It's slightly updated to use `pnpm` and `eslint`.
27 changes: 27 additions & 0 deletions src/misc/quadtree/js/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
description = "A Nix-flake-based Node.js development environment";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

outputs = { self, nixpkgs }:
let
overlays = [
(final: prev: rec {
nodejs = prev.nodejs-18_x;
pnpm = prev.nodePackages.pnpm;
yarn = (prev.yarn.override { inherit nodejs; });
})
];
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit overlays system; };
});
in
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [ node2nix nodejs pnpm yarn ];
};
});
};
}
16 changes: 16 additions & 0 deletions src/misc/quadtree/js/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>

<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.3/p5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.3/addons/p5.dom.min.js"></script>
<meta charset="utf-8" />

</head>

<body>
<script src="sketch.js"></script>
<script src="quadtree.js"></script>
</body>

</html>
27 changes: 27 additions & 0 deletions src/misc/quadtree/js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "quadtree",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"lint" : "pnpm exec eslint *.js --fix"
},
"keywords": [],
"author": "",
"license": "MIT",
"devDependencies": {
"eslint": "^8.55.0",
"eslint-config-google": "^0.14.0"
},
"eslintConfig": {
"env": {
"browser": true,
"es2021": true
},
"extends": "google",
"parserOptions": {
"ecmaVersion": "latest"
},
"rules": {}
}
}
Loading