James Hunter
- Twitter: @cccc00
- GitHub: orodio
var arr1 = [1, 2, 3, 4, 5]; | |
var arr2 = ["one", "two", "three", "four", "five"]; | |
map | |
[a] -> (a -> b) -> [b] | |
function double (v) { return v + v } | |
var a = arr1.map(double) | |
// a === [2, 4, 6, 8, 10] |
__git_ps1 () { | |
local b="$(git symbolic-ref HEAD 2>/dev/null)"; | |
if [ -n "$b" ]; then | |
printf " (%s)" "${b##refs/heads/}"; | |
fi | |
} | |
PS1="\[\033[0;35m\]\$(__git_ps1)\[\033[0m\] \[\033[0;33m\]\W\[\033[0m\] \$ " |
defmodule BankAccount do | |
def start do | |
await | |
end | |
def await, do: await([]) | |
def await events do | |
receive do | |
event = { :deposit, _amount } -> events = [ event | events ] | |
event = { :withdraw, _amount } -> events = [ event | events ] |
function digitalRoot (n) { | |
return n === 0 ? 0 : 1 + ((n - 1) % 9) | |
} | |
function sum (a,b) { return a + b } | |
function luhn (x) { | |
return String(x) | |
.trim() | |
.split("") |
function tokenize(input) { | |
return input | |
.replace(/[\(]/g, ' ( ') | |
.replace(/[\)]/g, ' ) ') | |
.trim() | |
.split(/\s+/); | |
} | |
function nest(input=[], list=[]) { | |
let token = input.shift() |
function value (line) { | |
const [, t, c, v] = line.split(" ") | |
return {t, p: {cursor: c.split("::"), value: v}} | |
} | |
function header (line) { | |
const [,...rest] = line.split(" ") | |
const c = rest.join(" ") | |
return {t: "header", c} | |
} |
import { shape, str, num, bool } from "facts" | |
shape(thingToCheck, { | |
foo: str, | |
bar: num, | |
rawr: { | |
name: str, | |
age: num, | |
alive: bool | |
} |
app_1 | [ 'save', | |
app_1 | 'lrem', | |
app_1 | 'auth', | |
app_1 | 'append', | |
app_1 | 'psetex', | |
app_1 | 'shutdown', | |
app_1 | 'sync', | |
app_1 | 'blpop', | |
app_1 | 'dbsize', | |
app_1 | 'rpop', |