Skip to content

Instantly share code, notes, and snippets.

View rwaldron's full-sized avatar

Rick Waldron rwaldron

  • Boston, MA
View GitHub Profile
@rwaldron
rwaldron / Setting up Google Cloud Storage with CORS for Web Fonts.md
Created January 16, 2018 21:47 — forked from mhulse/Setting up Google Cloud Storage with CORS for Web Fonts.md
Setting up CORS on Google Cloud Storage: An unofficial quick start guide to serving web fonts from Google's cloud. (I'm sure a lot of this info could be improved... Please leave comments if you have tips/improvements.)

Login:

Google Cloud Storage

You'll want to login using an official Google account (i.e. if this is for your company, use the comapany Gmail account vs. a personal one.)

When logging in, you might be prompted to verify the account; if so, enter your cell number to get a verification e-mail or phone call.

Once verified, you'll have to agree to the terms of service; do that, and click continue.

@rwaldron
rwaldron / getMyCode.js
Created September 24, 2011 16:37 — forked from creationix/getMyCode.js
Script to download all repos for a user
// Run this with node and then run the output with sh
var Http = require('http')
var ChildProcess = require('child_process');
Http.cat("http://github.com/api/v2/json/repos/show/creationix", function (err, json) {
if (err) throw err;
var data = JSON.parse(json);
data.repositories.forEach(function (repo) {
console.log("echo " + JSON.stringify(repo.name + " - " + repo.description));
console.log("git clone --bare " + repo.url);
});
@rwaldron
rwaldron / Pattern.lua
Created September 24, 2011 16:37 — forked from creationix/Pattern.lua
Pattern.js ported to Lua
Pattern = {}
function Pattern:extend(obj)
local child = obj or {}
setmetatable(child, {__index = self})
return child
end
function Pattern:new(...)
local obj = {}
@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'
#include <Servo.h>
//Create the 4 esc objects
Servo esc1;
Servo esc2;
Servo esc3;
Servo esc4;
//Esc pins
int escPin1 = 8;
/*!
* jQuery Tiny Pub/Sub - v0.X - 11/18/2010
* http://benalman.com/
*
* Original Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*
* Made awesome by Rick Waldron
*
/*
Usages:
$(selector).classList() //returns an array of classnames
$(selector).classList('newclass') //replaces the current element's classes
$(selector).classList(['new', 'class', 'names']) //replaces the current element's classes
*/
jQuery.fn.extend({
classList: function( value ) {
if( value ){

Building an ultrasonic sensor backpack

Note: This is a bit of a scratch to see what's involved in getting the ping sensor to work as an I2C backpack.

Acknowledgements

Dependencies.

@rwaldron
rwaldron / options-objects.js
Created September 19, 2012 18:43 — forked from ericf/gist:3751340
ES6 Object.assign( target, source ) as a native options object merging pattern.
let defaults = { file: null };
function foo(options) {
// Merging defaults and options objects in ES6
options = [ defaults, options ].reduce(Object.assign, {});
}
foo({ file: "happy.md" });
@rwaldron
rwaldron / TDZ.js
Created October 22, 2012 17:05 — forked from dherman/TDZ.js
temporary dead zone
// ---------------------------------------------------------------------
// 1. UNCONTROVERSIAL AMONGST TC39
// ---------------------------------------------------------------------
// read before write throws
{
console.log(x); // throws
let x = 12;
console.log(x);
}