Skip to content

Instantly share code, notes, and snippets.


Rick Waldron rwaldron

View GitHub Profile
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') {
dugdaniels / index.html
Created Jan 7, 2013
An example of a browser-based input for Johnny-Five. Clicking the button in index.html turns on and off an LED installed on the Arduino board.
View index.html
<script src=""></script>
<script src="/"></script>
$(document).ready(function() {
var socket = io.connect('http://localhost');
cowboy / call-invo-cursion.js
Last active Jul 18, 2017
JavaScript: call invo-cursion?
View call-invo-cursion.js
// OOP
console.log( 'OHAI'.blink() );
// Call invocation
console.log('OHAI') );
// $ always makes things look awesome.
var $ =;
// Very explicit call invocation
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 /
Last active Dec 15, 2015
ES6 needs a timeout - I reserve the right to change my mind about this


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] ( ""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'"").

View legis.R
# fast json library for R.
# drop in replacement for rjson (another library)
# use whatever you prefer
## hardcoded for this test
ny.json <- fromJSON("/Users/protonk/dev/R/nomnom/data.json")
unflatten <- function(json) {
domenic /
Last active Dec 17, 2015
Unabashed Monadic Promises on top of Q-Like Promises

Unabashed Monadic Promises on top of Q-Like Promises

Using the terminology from Mark Miller's "The Paradox of Partial Parametricity", this gist shows how you can build unabashed monadic promises on top of Q-like promises.

Problem Statement


Q: Ref<t> → Promise<t>
View Mapping.js
class Mapping {
// Subclasses define at least @@iterator().
@@iterator() {
throw TypeError("abstract operation")
// Mutable subclasses also define set() and delete().
set(key, value) {
throw TypeError("mapping is not mutable");
polotek / event_emitter_example.js
Last active Dec 17, 2015
Simple example of a node event emitter
View event_emitter_example.js
// Grab the EventEmitter constructor. events is a core node module.
var Emitter = require('events').EventEmitter;
// Our internal function will generate random numbers
function randomInt(limit) {
return Math.ceil( Math.random() * limit );
module.exports = function(limit) {
if(!(limit && limit > 0)) {
Protonk / notquitefusion.js
Last active Dec 18, 2015
Adjust the smoothing parameter w/ the sensor slider value.
View notquitefusion.js
var five = require("./lib/johnny-five.js"),
board, slider;
board = new five.Board();
board.on("ready", function() {
var accel = new five.Accelerometer({
pins: [ "I0", "I1" ],
freq: 100
You can’t perform that action at this time.