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/sh | |
if [ -z "$1" ]; then | |
echo "argument required" | |
exit 1 | |
else | |
jq "[.[].$1 | if (type) == \"array\" then .[] else [][] end] | length" | |
fi |
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
// very require | |
console.log(require('events')) |
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 timer = null | |
elem.addEventListener('click', function(){ | |
if(timer) { | |
clearTimeout(timer) | |
doStuff() | |
} | |
else timer = setTimeout(doStuff, 3000) | |
}) |
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 state = new (require('objectstate'))() | |
, write = require('dom-replace-html-stream') | |
, events = require('dom-event-stream') | |
, values = require('dom-value-stream') | |
var $input = document.body.appendChild(document.createElement('input')) | |
var $output = document.body.appendChild(document.createElement('h1')) | |
var input = events($input, 'input').pipe(values()) | |
var output = write($output) |
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(){ | |
// @lib https://github.com/bgrins/javascript-astar/blob/master/astar.js | |
!function(t){if("object"==typeof module&&"object"==typeof module.exports)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();window.astar=n.astar,window.Graph=n.Graph}}(function(){function t(t){for(var n=t,i=[];n.parent;)i.push(n),n=n.parent;return i.reverse()}function n(){return new o(function(t){return t.f})}function i(t,n){n=n||{},this.nodes=[],this.diagonal=!!n.diagonal,this.grid=[];for(var i=0;i<t.length;i++){this.grid[i]=[];for(var o=0,s=t[i];o<s.length;o++){var r=new e(i,o,s[o]);this.grid[i][o]=r,this.nodes.push(r)}}this.init()}function e(t,n,i){this.x=t,this.y=n,this.weight=i}function o(t){this.content=[],this.scoreFunction=t}var s={search:function(i,e,o,r){i.cleanDirty(),r=r||{};var h=r.heuristic||s.heuristics.manhattan,c=r.closest||!1,u=n(),a=e;for(e.h=h(e,o),u.push(e);u.size()>0;){var f=u.pop();if(f===o)return t(f);f.closed=!0;for(var p=i.neighbors(f),l=0,d=p.length;d> |
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(){ | |
// @lib https://github.com/bgrins/javascript-astar/blob/master/astar.js | |
!function(t){if("object"==typeof module&&"object"==typeof module.exports)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();window.astar=n.astar,window.Graph=n.Graph}}(function(){function t(t){for(var n=t,i=[];n.parent;)i.push(n),n=n.parent;return i.reverse()}function n(){return new o(function(t){return t.f})}function i(t,n){n=n||{},this.nodes=[],this.diagonal=!!n.diagonal,this.grid=[];for(var i=0;i<t.length;i++){this.grid[i]=[];for(var o=0,s=t[i];o<s.length;o++){var r=new e(i,o,s[o]);this.grid[i][o]=r,this.nodes.push(r)}}this.init()}function e(t,n,i){this.x=t,this.y=n,this.weight=i}function o(t){this.content=[],this.scoreFunction=t}var s={search:function(i,e,o,r){i.cleanDirty(),r=r||{};var h=r.heuristic||s.heuristics.manhattan,c=r.closest||!1,u=n(),a=e;for(e.h=h(e,o),u.push(e);u.size()>0;){var f=u.pop();if(f===o)return t(f);f.closed=!0;for(var p=i.neighbors(f),l=0,d=p.length;d> |
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 http = require('http') | |
, moment = require('moment') | |
module.exports = function(ziggy) { | |
ziggy.on('message', handle) | |
function handle(user, channel, message) { | |
var arg |
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 knob = require('dom-knob') | |
var elem = document.body.appendChild(document.createElement('div')) | |
elem.style.background = 'red' | |
elem.style.padding = '100px' | |
elem.style.fontSize = '30px' | |
knob(elem, function(deg) { | |
elem.innerHTML = deg |
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 | |
# compile brainf*ck to groot | |
# "+" "i am groot" | |
# "-" "I am Groot" | |
# "." "I AM GROOOT" | |
# ">" "I AM GROOT" | |
# "<" "I am groot" | |
# "," "I am grooot" |
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
i am groot | |
i am groot | |
i am groot | |
i am groot | |
i am groot | |
i am groot | |
i am groot | |
i am groot | |
i am groot | |
i am groot |
OlderNewer