Skip to content

Instantly share code, notes, and snippets.

View gist:9866671
function* asyncIterator() {
let value, done;
while ({value, done} = (yield null), !done) {
console.log("got", value);
}
console.log("done");
}
it = asyncIterator();
it.next();
View sparkio-test.js
var five = require("johnny-five");
var Spark = require("spark-io");
var board = new five.Board({
io: new Spark({
token: process.env.SPARK_TOKEN,
deviceId: process.env.SPARK_DEVICE_ID
})
});
View __.md

Inspired by Robert O'Callahan's blog

To reduce the need for "visual confirmation" tests:

  • store the base-64 encoded data-uri of a reference png as a string
  • copy the outerHTML of your test fixture into an SVG wrapper, prefixed with "data:image/svg+xml,"
  • set the src of an image to the value of the SVG wrapper
  • copy the image into a canvas context
  • assert equality of canvas.context.toDataURL() and previously stored reference string
View gist:3751340
let defaults = {},
overrides = {};
function foo(bar, options) {
// YUI
options = Y.merge(defaults, options, overrides);
// Underscore
options = _.extend({}, defaults, options, overrides);
View Custom.css
/**********************************************/
/*
/* IR_Dark_Monokai
/* Designed and developed by Andres Pagella (@mapagella)
/* http://www.andrespagella.com/customising-chrome-devtools
/*
/* Based on Ben Truyman's IR_Black
/* which is...
/* Based on Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
@disnet
disnet / scheme.sjs
Created Oct 8, 2012
start of scheme in sweet.js (modified from http://pastebin.com/0nPBg8LY)
View scheme.sjs
macro sexp {
case () => {
;
}
case ($p) => {
$p
}
case ($x $y) => {
$x($y);
}
@tcr
tcr / Vagrantfile
Last active Nov 29, 2015
tessel 2 openwrt in packer
View Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.username = "root"
config.ssh.password = "tessel2"
config.ssh.shell = "ash"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.box = "technicalmachine/tessel2"
@andrew
andrew / xbox.js
Created Dec 29, 2012
Xbox Controller in Node.js (wip)
View xbox.js
var HID = require('HID');
var util = require('util');
var events = require('events');
var devices = HID.devices();
var device
devices.forEach((function(d) {
if(typeof d === 'object' && d.product.toLowerCase() === 'controller') {
@jlongster
jlongster / input.ljs
Last active Dec 15, 2015
LLJS compiling to asm.js
View input.ljs
struct Point {
function void Point(double x, double y) {
this->x = x;
this->y = y;
}
double x, y;
}
function int add1(int x) {
@dfkaye
dfkaye / es6-timeout.md
Last active Dec 15, 2015
ES6 needs a timeout - I reserve the right to change my mind about this
View es6-timeout.md

2013-3-30

Some recent activity from active contributors regarding ES6 proposals threaten to undermine its acceptance from the community at large.

ES6 proposals include the fat arrow, destructured assignment, splat args, let/block scope, class syntax, class-based inheritance, setters/getters with export, the module loader syntax, weak maps, weak events, @symbols, and so forth.

That is a lot for a community user of the language to comprehend. It is a lot for a single iteration of any project.

The sheer amount of change is at root of the confusion apparent even among the es-discuss mailing list ~ [see this conversation for an example] (https://twitter.com/kangax/status/315863525899780096 ""that was removed from the spec", "I thought it was back in", "it's on the table", "'on the table' does not mean 'in the spec'"").