This file contains 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
var request = require('request-promise'); | |
var highland = require('highland'); | |
var promiseToStream = highland; | |
var arrayToStream = highland; | |
var pollerToStream = highland; | |
function eventTime(event) { | |
return new Date(event.createdAt).getTime(); | |
} |
This file contains 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
#!/bin/bash | |
while : | |
do | |
clear | |
lines=`tput lines` | |
lines=`expr $lines - 2` | |
git --no-pager log --graph --pretty=oneline --abbrev-commit --decorate --all --color $* | head -n $lines | |
sleep 1 | |
done |
This file contains 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
app.controller( 'AppCtrl', function ($scope, socket) { | |
socket.onopen( | |
function(){ | |
console.log('Socket is connected :D') | |
} | |
) | |
socket.onclose( | |
function(){ | |
console.log('Socket is disconnected :(') | |
} |
This file contains 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
test |
This file contains 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
function getElementsByAttribute(attrName, root) { | |
root = root || document; | |
if (root.querySelectorAll) { | |
return root.querySelectorAll("[" + attrName + "]"); | |
} | |
else { | |
var ret = []; | |
var elems = root.getElementsByTagName("*"); | |
for (var n = 0, ele; ele = elems[n++];) { | |
if (ele.hasAttribute(attrName)) { |
This file contains 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
$ var personPromise = new Promise((resolve, reject) => { | |
setTimeout(function() { | |
reject('oh no'); | |
}, 1000); | |
}); | |
<await(person from personPromise)> | |
<div>Works</div> | |
<await-error>something went wrong</await-error> | |
</await> |
This file contains 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 client = sanityClient({ | |
projectId: 'p354jyup', | |
dataset: 'main', | |
useCdn: true, | |
}); | |
// needs polyfill | |
const origin = window.location.origin | |
client.clientConfig.cdnUrl = `${origin}/sanity`; |
This file contains 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 stiftemaskinenMachine = Machine({ | |
id: 'stiftemaskinen', | |
initial: 'pristine', | |
states: { | |
pristine: { | |
on: { | |
TOUCH_FORM: { | |
target: 'open', |
This file contains 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 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 * as rt from 'runtypes'; | |
export type JSONPrimitive = string | number | boolean | null; | |
export type JSONValue = JSONPrimitive | JSONObject | JSONArray; | |
export type JSONObject = { [member: string]: JSONValue }; | |
export type JSONArray = Array<JSONValue>; | |
type JSONRoot = JSONArray | JSONObject; | |
const JSONPrimitiveRt = rt.Intersect(rt.String, rt.Number, rt.Boolean, rt.Null); | |
const JSONValueRt: rt.Runtype<JSONValue> = rt.Lazy(() => |