Skip to content

Instantly share code, notes, and snippets.

View lukechilds's full-sized avatar
☂️
Building @getumbrel

Luke Childs lukechilds

☂️
Building @getumbrel
View GitHub Profile
@lukechilds
lukechilds / app.html
Last active May 12, 2016 10:38 — forked from jdanyow/app.html
Aurelia Inconsistent Template Behaviour
<template>
<h1>${message}</h1>
<button click.delegate="addNumber('before')">Add number before</button>
<button click.delegate="addNumber('after')">Add number after</button>
<div>
<span repeat.for="number of numbers">${number}</span>
</div>
</template>
@lukechilds
lukechilds / app.html
Last active May 12, 2016 10:45
Aurelia Inconsistent Template Behaviour Fix
<template>
<h1>${message}</h1>
<button click.delegate="addNumber('before')">Add number before</button>
<button click.delegate="addNumber('after')">Add number after</button>
<div>
<span repeat.for="number of numbers">${number}</span>
</div>
</template>
@lukechilds
lukechilds / app.html
Last active May 12, 2016 11:08
Aurelia Image reuse template bug
<template>
<h1>${message}</h1>
<button click.delegate="addImage('before')">Add image before</button>
<button click.delegate="addImage('after')">Add image after</button>
<div>
<img width="200" repeat.for="image of images" src.bind="image" />
</div>
</template>
@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@lukechilds
lukechilds / git-yup.sh
Created August 23, 2016 16:23
Git Yup
alias yup='eval $(fc -ln -1 | sed "s/git/git -c \"help.autocorrect=-1\"/")'

Keybase proof

I hereby claim:

  • I am lukechilds on github.
  • I am lukechilds (https://keybase.io/lukechilds) on keybase.
  • I have a public key whose fingerprint is EA9F 04E5 61A1 D109 87E3 E2E6 93D6 12A9 D61C 281A

To claim this, I am signing this object:

@lukechilds
lukechilds / README.md
Created April 11, 2017 06:09
JavaScript performance testing accurate to 5 microseconds in 59 bytes

Performance testing accurate to 5 microseconds in 57 bytes

Test JavaScript methods against each other accurate to 5 microseconds (five thousandths of a millisecond).

Usage

time = fn=>{let t=()=>performance.now(),s=t();fn();return t()-s}
time(() => document.querySelectorAll('span'))
// 0.18499999959021807
const iterations = 100000000;
(() => {
console.time('Var While');
var iVarWhile = 0;
while (iVarWhile < iterations) {
iVarWhile += 2;
}
console.timeEnd('Var While');
})();
@lukechilds
lukechilds / filesizecomparison.txt
Created May 29, 2017 09:22
UTF-8 vs gzip vs gzip+Base64
$ wget todomvc.com
--2017-05-29 16:13:28-- http://todomvc.com/
Resolving todomvc.com... 192.30.252.154, 192.30.252.153
Connecting to todomvc.com|192.30.252.154|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 254815 (249K) [text/html]
Saving to: 'index.html'
index.html 100%[===========================>] 248.84K 215KB/s in 1.2s

Keybase proof

I hereby claim:

  • I am lukechilds on github.
  • I am lukechilds (https://keybase.io/lukechilds) on keybase.
  • I have a public key ASAqC3NB9y98h4sOGcD5Jr9ax5HJpCiJgcxPoZawvLAbnQo

To claim this, I am signing this object: