This file contains hidden or 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
bower = (files, metalsmith, done) -> | |
include = (root, included) -> | |
for file in included | |
contents = readFileSync(file) | |
files["#{root}/#{basename(file)}"] = | |
contents: contents | |
include('css', lib.self().ext('css').files) | |
include('js', lib.self().ext('js').files) | |
include('fonts', lib.self().ext(['eot','otf','ttf','woff']).files) | |
done() |
This file contains hidden or 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
angular.module 'ngScrollSupport', [] | |
.directive 'ngScrollSupport', -> | |
restrict: 'A' | |
link: (scope, element, attrs) -> | |
atTop = true | |
atBottom = false | |
check = -> | |
scrollTop = element.prop 'scrollTop' | |
scrollHeight = element.prop 'scrollHeight' | |
clientHeight = element.prop 'clientHeight' |
This file contains hidden or 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
npm ls | gawk 'match($0, "[| +--`]*([^@]*).*", ary) { print ary[1] }' | sort | uniq |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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
let numberRegexp = /^[0-9]+$/; | |
export interface Validator<T> { | |
isAcceptable(t: T): boolean; | |
} | |
export class ZipCodeValidator implements Validator<String> { | |
isAcceptable(s: string) { | |
return s.length === 5 && numberRegexp.test(s); | |
} |
This file contains hidden or 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 numberRegexp = /^[0-9]+$/; | |
export type Validator<T> = (t: T) => boolean | |
export function validZip(s: string) { | |
return s.length === 5 && numberRegexp.test(s); | |
} | |
validZip("09809"); // true |
This file contains hidden or 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
import jwt from 'jsonwebtoken' | |
import { certToPEM } from './utils' | |
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
async function latestKeys() { | |
console.log('Fetching latest') | |
const latest = await fetch( |
This file contains hidden or 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
This file contains hidden or 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
let bottles = (number) => switch(number) { | |
| 0 => "no more bottles of beer" | |
| 1 => "1 bottle of beer" | |
| n => { | |
let formatted = string_of_int(n); | |
{j|$formatted bottles of beer|j}; | |
} | |
} | |
let rec countdownFrom = (current) => current == 0 ? { |
This file contains hidden or 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |