curl -sSL https://get.haskellstack.org/ | sh
stack upgrade
Then ensure ~/.local/bin
is on your $PATH
.
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE keyboard SYSTEM "file://localhost/System/Library/DTDs/KeyboardLayout.dtd"> | |
<keyboard group="0" id="5001" name="British PC Layout" maxout="2"> | |
<layouts> | |
<layout first="0" last="0" modifiers="48" mapSet="312" /> | |
</layouts> | |
<modifierMap id="48" defaultIndex="0"> | |
<keyMapSelect mapIndex="0"> | |
<modifier keys="" /> | |
</keyMapSelect> |
function group (rows, discriminant) { | |
const asMap = rows.reduce( | |
(acc, item) => { | |
const key = item[discriminant] | |
return { | |
...acc, | |
[key]: acc[key] ? [...acc[key], item] : [item] | |
} | |
}, | |
{} |
function throttleGroup(fn, count, delay) { | |
let queue = []; | |
let nextDrain = null; | |
function scheduleDrain() { | |
nextDrain = window.setTimeout(drainQueue, delay); | |
} | |
function drainQueue() { | |
const groupSize = Math.min(count, queue.length); |
// Get a WebGL context | |
import {Perhaps, None, Some, Any} from 'highly-questionable'; | |
const canvas = document.createElement('canvas'); | |
const context = Perhaps | |
.of(canvas.getContext('webgl2')) | |
.or(canvas.getContext('webgl')) | |
.orFrom(()=> canvas.getContext('experimental-webgl')); |
function firstTruthy<T>(promises: Array<Promise<any>>): Promise<T|null> { | |
return new Promise((resolve, reject) => { | |
// If any promise returns truthy value, immediately resolve with it | |
promises.forEach(async promise => { | |
const result = await promise; | |
if (!!result) resolve(result); | |
}); | |
// If any promise rejects, immediately throw the error | |
Promise.race(promises).catch(reject); |
/// <reference types="node" /> | |
declare module 'watchr' { | |
import {Stats, FSWatcher} from 'fs'; | |
import {EventEmitter} from 'events'; | |
export type ChangeType = 'update' | 'create' | 'delete'; | |
export type State = 'pending' | 'active' | 'deleted' | 'closed'; |
## Personas | |
## Subjects/Verbs :: Characters/Action | |
## Sentences should flow old information -> new | |
## Keep topics coherent | |
## Use topics to assign responsibility |
require 'sinatra' (1)
get '/hi' do (2) (3)
"Hello World!"
end
Library import
URL mapping
const fs = require('fs'); | |
const cliArgs = process.argv.slice(2); | |
const key = cliArgs[0]; | |
const val = cliArgs[1]; | |
function parseJSON(string) { | |
const sanitised = string.replace(/\s\$\w*/g, substr => `"__SANITISED__${substr}"`); | |
return JSON.parse(sanitised); | |
} |