Skip to content

Instantly share code, notes, and snippets.

@L-A
L-A / quadtree.js
Created October 19, 2020 20:25
Basic quadtree implementation in JS
// Utilities
const distance = (x1, y1, x2, y2) =>
Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
// The quadtree
export default class QuadTree {
constructor(x, y, width, height, capacity = 4) {
this.x = x;
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active July 9, 2024 15:59
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gasman
gasman / pnginator.rb
Created April 30, 2012 18:08
pnginator: pack Javascript into a self-extracting PNG
#!/usr/bin/env ruby -w
# pnginator.rb: pack a .js file into a PNG image with an HTML payload;
# when saved with an .html extension and opened in a browser, the HTML extracts and executes
# the javascript.
# Usage: ruby pnginator.rb input.js output.png.html
# By Gasman <http://matt.west.co.tt/>
# from an original idea by Daeken: http://daeken.com/superpacking-js-demos