Skip to content

Instantly share code, notes, and snippets.

Avatar

Nathan nathan

View GitHub Profile
@nathan
nathan / pack.js
Created Feb 24, 2019
CaseFolding.txt packer
View pack.js
const itt = require('/Users/nox/n/itt')
const CASE_FOLD = {
// common
"\u{0041}":"\u{0061}","\u{0042}":"\u{0062}","\u{0043}":"\u{0063}","\u{0044}":"\u{0064}","\u{0045}":"\u{0065}","\u{0046}":"\u{0066}","\u{0047}":"\u{0067}","\u{0048}":"\u{0068}","\u{0049}":"\u{0069}","\u{004A}":"\u{006A}","\u{004B}":"\u{006B}","\u{004C}":"\u{006C}","\u{004D}":"\u{006D}","\u{004E}":"\u{006E}","\u{004F}":"\u{006F}","\u{0050}":"\u{0070}","\u{0051}":"\u{0071}","\u{0052}":"\u{0072}","\u{0053}":"\u{0073}","\u{0054}":"\u{0074}","\u{0055}":"\u{0075}","\u{0056}":"\u{0076}","\u{0057}":"\u{0077}","\u{0058}":"\u{0078}","\u{0059}":"\u{0079}","\u{005A}":"\u{007A}","\u{00B5}":"\u{03BC}","\u{00C0}":"\u{00E0}","\u{00C1}":"\u{00E1}","\u{00C2}":"\u{00E2}","\u{00C3}":"\u{00E3}","\u{00C4}":"\u{00E4}","\u{00C5}":"\u{00E5}","\u{00C6}":"\u{00E6}","\u{00C7}":"\u{00E7}","\u{00C8}":"\u{00E8}","\u{00C9}":"\u{00E9}","\u{00CA}":"\u{00EA}","\u{00CB}":"\u{00EB}","\u{00CC}":"\u{00EC}","\u{00CD}":"\u{00ED}","\u{00CE}":"\u{00EE}","\u{00CF}":"\u{00EF}","\u{00D0
@nathan
nathan / LICENSE
Last active Aug 19, 2020
Indentation tokens in moo.
View LICENSE
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@nathan
nathan / install.sh
Created Apr 29, 2015
Install Elm 0.15 on GHC 7.10, or else.
View install.sh
mkdir elm
cd elm
git clone https://github.com/nathan/edit-distance
git clone https://github.com/nathan/language-glsl
git clone https://github.com/nathan/elm-compiler
git clone https://github.com/nathan/elm-package
git clone https://github.com/nathan/elm-make
git clone https://github.com/nathan/elm-reactor
git clone https://github.com/nathan/elm-repl
@nathan
nathan / test.diff
Created Apr 9, 2015
Phosphorus SVG namespace fixer.
View test.diff
diff --git a/phosphorus.js b/phosphorus.js
index 532f392..9198e0c 100644
--- a/phosphorus.js
+++ b/phosphorus.js
@@ -466,7 +466,18 @@ var P = (function() {
};
IO.fixSVG = function(svg, element) {
- if (element.nodeType !== 1) return;
+ var name = element.nodeName.match(/^svg:(.*)/i);
@nathan
nathan / snapshot.xml
Created Apr 9, 2015
Project from Snap! homepage.
View snapshot.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="Untitled" app="Snap! 4.0, http://snap.berkeley.edu" version="1">
<notes />
<thumbnail>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAB4CAYAAAB1ovlvAAAYOUlEQVR4Xu3dA5SkSRYF4Oixbdu2bdu2bdu2bdu2bdu2e88Xu683t7Z3pqdnp6r/yIhz8lRmVv7IjJv3vnffiz+7de/evXuqo34CXfQJdKsA7KJPvh42fwIVgBUIXfoJVAB26cdfD14BWDHQpZ9ABWCXfvz14BWAFQNd+glUAHbpx18PXgFYMdCln0AFYJd+/PXgFYAVA136CVQAdunHXw9eAVgx0KWfQAVgl3789eAVgH8zBn788cfUf//9/8dRZppppnTffff9zUduxu4rAP/mefryyy/Taqutlo455pg06qijplVXXTV9/fXX6Yorrvibj9yM3VcAdsI8zTLLLGnYYYdN77zzThpllFHSwAMPnM4555xOOHKff4gKwE6Yo/fffz9ttNFGPY40+OCDpzPOOKMTjtznH6ICsJPmaMEFF0wDDDBAPlp//fWXLrzwwk46cp99mArATpqf119/PW211Vb5aOOOO2466KCDOunIffZhKgA7cX4WWWSR1G+//eZEZKmllurEI/e5h6oA7MS5efnll9N2222Xjj766JyM1FHXhHQ6BhZbbLF01VVXdfpx+9QDVgbs5Jm56aab0nzzzdfJR+1zD1cB+H+em1NPPTWtvfbaaZtttkmHHHJIuv7665MM+IEHHkgzzDBDj8f/58M2dncVgH9x6t566630/fffJ8w2wQQTpHnnnTettdZa6bTTTku77bZb2muvvbLlsvzyy6ebb745/7+Of38CFYC9gYZlllkmHXjggenOO+9MU045ZY7pdt9993TJJZekfvrpJ2e6jz76aBp66K
@nathan
nathan / ob.coffee
Created Dec 13, 2014
Obfuscated CoffeeScript
View ob.coffee
phrase = "Just another CoffeeScript Hacker, "
i = 0
J = (j) -> j
u = (j) -> $ "J"; a j + 14
s = (j) -> $ "n"; r j * 5
t = (j) -> $ "o"; k j * 3 + 13
_ = (j) -> $ "i"; j * 5 + 9
а = (j) -> $ " "; o j + 5
n = (j) -> $ "a"; (j * 5 + 1) % 10
@nathan
nathan / Main.elm
Created Oct 19, 2014
The code in the screenshot for elm-editor.
View Main.elm
main = lift clock (every second)
clock t = collage 400 400
[ filled lightGrey (ngon 12 110)
, outlined (solid grey) (ngon 12 110)
, hand orange 100 t
, hand charcoal 100 (t/60)
, hand charcoal 60 (t/720) ]
View Spirals.txt
Stage
=====
Variables
---------
- n = 30
- last mouse x = 227
- last mouse y = 180
- pen size = 2
@nathan
nathan / broken.js
Created Jul 29, 2014
Find broken PNG assets in a project.
View broken.js
var all = document.body.innerText.match(/\w{32}\.png/g);
var broken = [];
all.forEach(function(a) {
var xhr = new XMLHttpRequest;
xhr.open('GET', 'http://cdn.scratch.mit.edu/internalapi/asset/'+a+'/get/', false);
xhr.send();
if (/^<svg/.test(xhr.responseText)) {
broken.push(a);
console.log('http://cdn.scratch.mit.edu/internalapi/asset/'+a+'/get/');
}
You can’t perform that action at this time.