Skip to content

Instantly share code, notes, and snippets.

View rwaldron's full-sized avatar

Rick Waldron rwaldron

  • Boston, MA
View GitHub Profile
(function( jQuery ) {
var getScript = jQuery.getScript;
jQuery.getScript = function( resources, callback ) {
var // reference declaration & localization
length = resources.length,
handler = function() { counter++; },
deferreds = [],
@rwaldron
rwaldron / array.extensions.md
Last active May 4, 2022 13:46
Array.from and Array.of
@rwaldron
rwaldron / git_logging.txt
Created April 25, 2012 16:27 — forked from softprops/git_logging.txt
fancy git log flags
git log --all --pretty=format:"%h %cd %s (%an)" --since='7 days ago'
git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short
git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short --since='1 day ago'
git log --pretty=format:"%ad, %s%d [%an]" --graph --date=short --since='1 day ago'
@rwaldron
rwaldron / style-guide.js
Created January 24, 2011 18:20
Writing Idiomatic JavaScript
1. Two space soft indents (fake tabs) OR tabs... BUT NEVER BOTH - DO NOT MIX
2. Whitespace, Parens, Braces, Linebreaks
if/else/for/while/try always have spaces, braces and multiple lines.
--------------------------------------------------------------------
@rwaldron
rwaldron / jquery.hasattr.js
Created May 31, 2011 15:14
A commonly requested feature that is simply not worth adding to jQuery core. Usage: http://jsfiddle.net/rwaldron/kSmP2/
/*!
* jQuery.fn.hasAttr()
*
* Copyright 2011, Rick Waldron
* Licensed under MIT license.
*
*/
(function( jQuery ) {
jQuery.fn.hasAttr = function( name ) {
for ( var i = 0, l = this.length; i < l; i++ ) {
#include <Servo.h>
//Create the 4 esc objects
Servo esc1;
Servo esc2;
Servo esc3;
Servo esc4;
//Esc pins
int escPin1 = 8;
@rwaldron
rwaldron / kinect-controlled-robot-arm.js
Last active November 4, 2021 16:27
Johnny-Five + OpenNI: Kinect-controlled Arduino Robotic Arm. http://jsfiddle.net/rwaldron/XMsGQ/show/light
"use strict";
var five, PVector, OpenNI;
five = require("../lib/johnny-five.js");
/**
* Note:
*
* PVector is a slightly-ported version of
* Processing.js's PVector.
@rwaldron
rwaldron / complete-character-set.js
Last active October 23, 2021 02:07
Character set: 0-9, A-Z, a-z for seven segment displays
{
"0": 0x7E,
"1": 0x30,
"2": 0x6D,
"3": 0x79,
"4": 0x33,
"5": 0x5B,
"6": 0x5F,
"7": 0x70,
"8": 0x7F,
Object.assign = function( O, dictionary ) {
var target, src;
// Let target be ToObject(O).
target = Object( O );
// Let src be ToObject(dictionary).
src = Object( dictionary );
// For each own property of src, let key be the property key
import EventEmitter from "events";
let priv = new WeakMap();
let simulatorCoords = [
[40.678178, -73.944158],
[40.678181, -73.943267],
[40.678083, -73.941593],
[40.678034, -73.940649],
];
let index = 0;