View 2021.21.golfed.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I=(await(await fetch("https://adventofcode.com/2021/day/21/input")).text(w=W=0)).match(/(\d+)/g) | |
u=(c,...a)=>{for(let i in U=[,,,1,3,6,7,6,3,1])U[i]&&((r,c,p,P,s=0,S=0,t)=>(((s+=p=((p-1+r)%10)+1)>20)&&(t?W+=c:w+=c),s<21&&u(c,P,p,S,s,!t)))(+i,U[i]*c,...a)} | |
u(1,I[1],I[3]) | |
w>W?w:W |
View 2021.20.full.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// comment out top line if you are running it first time... don't blast that fetch! | |
// I=(await(await fetch("https://adventofcode.com/2021/day/20/input")).text()); | |
// I=`..#.#..#####.#.#.#.###.##.....###.##.#..###.####..#####..#....#..#..##..###..######.###...####..#..#####..##..#.#####...##.#.#..#.##..#.#......#.###.######.###.####...#.##.##..#..#..#####.....#.#....###..#.##......#.....#..#..#..##..#...##.######.####.####.#.#...#.......#..#.#.#...####.##.#......#..#...##.#.##..#...##.#.##..###.#......#.#.......#.#.#.####.###.##...#.....####.#..#..#.##.#....##..#.####....##...##..#...#......#.#.......#.......##..####..#...#.#.#...##..#.#..###..#####........#..####......#..# | |
// #..#. | |
// #.... | |
// ##..# | |
// ..#.. | |
// ..###`; | |
[key,...rest]=I.split(/\n+/) |
View 2021.19.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
L=JSON.stringify | |
Z="map" | |
A=(x,y)=>Math.abs(x-y)**2 | |
X='+!!!+!!!++!!!!-!+!+!!!-!!!-+!!!!+!-!!-!+!!!!+!!++!!!+!!+!+!!!!-!!-+!!!-!-!!!-!!!+-!!!!-!-!-!!!+!!!--!!!!+!+!!+!-!!!!+!!+-!!!-!!-!-!!!!-!!--!!!+!!!-!+!+!!!+!!!++!!!!+!-!+!!!-!!!-+!!!!-!-!-!!!-!!!+-!!!!+!+!-!!!+!!!--!!' | |
for(T=[],x=0;x<X.length;)z=()=>(+eval(X[x++]+1)),T.push([[z(),z(),z()],[z(),z(),z()],[z(),z(),z()]]) | |
M=(m,t)=>m.map((_,i)=>m[0]*t[i][0]+m[1]*t[i][1]+m[2]*t[i][2]) | |
Q=[];(await(await fetch("https://adventofcode.com/2021/day/19/input")).text()).split('\n').map(i=>i.replace(/ (\d+)/,(_,n)=>(q=n,Q[n]=[])).replace(/(-?\d+),(-?\d+),(-?\d+)/,(_,x,y,z)=>Q[q].push([+x,+y,+z]))) | |
D=D=>D.map(o=>D.map(p=>A(o[0],p[0])+A(o[1],p[1])+A(o[2],p[2]))) | |
for(R=Q[0],R.l=[0,0,0];Q.filter(q=>!q.l).find(q=>{H=[] | |
for(x in (e=D(R)))for(B in (d=D(q)))d[B].filter(a=>e[x].includes(a)).length>11&&H.push([x,B]) |
View auto-readme-real-source.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const storyFiles = require.context('../src', true, /__stories__\/.+\.js$/) | |
const sources = require.context('!!raw-loader!../src', true, | |
/__stories__\/.+\.js$/) | |
const readme = require.context('!!raw-loader!../src', true, /README\.md$/) | |
const READMES = readme.keys().reduce((memo, key) => { | |
const [,baseName] = key.match(/^\.\/([^\/]+)\//) | |
memo[baseName] = readme(key) | |
return memo | |
}, {}) |
View gist:1c68513382e53b09772d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"detects no available moves": { | |
"comment": "The board looks like this:", | |
"boardDesc0": "123", | |
"boardDesc1": "231", | |
"boardDesc2": "312", | |
"state": { |
View Vagrantfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
require 'yaml' | |
config_yml = YAML.load_file(File.open(File.expand_path(File.dirname(__FILE__)) + "/vagrant-config.yml")) | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what |
View test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomElement extends HTMLElement { | |
constructor() { | |
super(); | |
} | |
attachedCallback() { | |
this.bindEvents(); | |
} | |
detachedCallback() { |
View gist:a59255719f0b06322d96
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sh: napa: command not found | |
npm ERR! Darwin 14.1.0 | |
npm ERR! argv "node" "/usr/local/bin/npm" "install" | |
npm ERR! node v0.12.0 | |
npm ERR! npm v2.7.3 | |
npm ERR! code ELIFECYCLE | |
npm ERR! ember-templates-loader@1.3.0 install: `napa` | |
npm ERR! Exit status 127 | |
npm ERR! |
View err.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var clone = require("./").Clone.clone; | |
function errorLog(err) { | |
console.error(err); | |
} | |
// Look up this known commit. | |
function getCommit(repo) { | |
// Use a known commit sha from this repository. | |
return repo.getCommit("59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5"); |
NewerOlder