Skip to content

Instantly share code, notes, and snippets.

const input = `vxjtwn vjnxtw sxibvv mmws wjvtxn icawnd rprh
fhaa qwy vqbq gsswej lxr yzl wakcige mwjrl
bhnlow huqa gtbjc gvj wrkyr jgvmhj bgs umo ikbpdto
drczdf bglmf gsx flcf ojpj kzrwrho owbkl dgrnv bggjevc
ndncqdl lncaugj mfa lncaugj skt pkssyen rsb npjzf
kdd itdyhe pvljizn cgi
jgy pyhuq eecb phwkyl oeftyu pyhuq hecxgti tpadffm jgy
zvc qdk mlmyj kybbh lgbb fvfzcer frmaxa yzgw podt dbycoii afj
zfr msn mns leqem frz
golnm ltizhd dvwv xrizqhd omegnez nan yqajse lgef
const data = `515 912 619 2043 96 93 2242 1385 2110 860 2255 621 1480 118 1230 99
161 6142 142 1742 237 6969 211 4314 5410 4413 3216 6330 261 3929 5552 109
1956 4470 3577 619 105 3996 128 1666 720 4052 108 132 2652 306 1892 1869
2163 99 2257 895 112 1771 1366 1631 2064 2146 103 865 123 1907 2362 876
1955 3260 1539 764 185 5493 5365 5483 4973 175 207 1538 4824 205 1784 2503
181 3328 2274 3798 1289 2772 4037 851 1722 3792 175 603 725 158 2937 174
405 247 2083 956 725 258 2044 206 2054 561 2223 2003 2500 355 306 2248
837 937 225 1115 446 451 160 1219 56 61 62 922 58 1228 1217 1302
1371 1062 2267 111 135 2113 1503 2130 1995 2191 129 2494 2220 739 138 1907
3892 148 2944 371 135 1525 3201 3506 3930 3207 115 3700 2791 597 3314 132
const testCases = [
['1122', 3],
['1111', 4],
['1234', 0],
['91212129', 9]
]
const isDoubler = (n, i, arr) =>
or (
equals(arr[inc(i)], n),
@joeegan
joeegan / tmux_cheatsheet.markdown
Last active November 1, 2017 20:54 — forked from henrik/tmux_cheatsheet.markdown
tmux cheatsheet

Outside of tmux

start new:

tmux

start new with session name:

tmux new -s myname
// From http://randycoulman.com/blog/2016/06/07/thinking-in-ramda-partial-application/
const books = [{title: 'foo', year: 1984}, {title: 'bar', year: 1985}]
// original
const publishedInYear = (book, year) => book.year === year
const titlesForYear = (books, year) => {
const selected = filter(book => publishedInYear(book, year), books)
@joeegan
joeegan / compose-pipe.js
Last active September 5, 2017 10:50
compose over pipe
a(b(c(true))))
pipe(c, b, a)(true)
compose(a, b, c)(true)
// compose...
// haskell: a . b . c true
// elm & elixir: a <| b <| c true
@joeegan
joeegan / restargs-spread.js
Created September 5, 2017 10:36
restArgs & spread clarification
const stringify = (a, b) =>
toString(a + b);
const init = (a, b) => // anti pattern
stringify(...[a, b]) // stringify(a, b)
const init = (...args) =>
stringify(...args)
const init = (a, b) =>
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
obj: Ember.computed(function() {
return Ember.Object.create();
}),
init() {
debugger;
this._super();
const getDelay = () => Math.random() * 1000;
(function timeout(delay) {
setTimeout(() => {
console.log(delay);
timeout(getDelay());
}, delay);
})(0);