Skip to content

Instantly share code, notes, and snippets.

@rmurphey
rmurphey / gist:3308827
Created August 9, 2012 23:02
Change the color of an LED based on accelerometer orientation
var five = require("../lib/johnny-five.js"),
board, distance, vibration, accel,
red, green, blue;
board = new five.Board();
board.on("ready", function() {
var status = new five.Led(13);
status.on();
@michaelfeathers
michaelfeathers / gist:3827233
Created October 3, 2012 14:33
Code volume
# A poor man's complexity measure for a file or group of files
puts ARGF.lines.grep(/^([ \t]*)/) { $1 }.map(&:length).reduce(0, :+)
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
def field_names
@field_names ||= @expression.flatten
.each_cons(2)
.select {|marker, _| marker == :@ivar }
.map {|_,name| field_name(name) }
end
--returns rows in random order
select * from sometable order by random();
--use '::' for casting
select '2013-01-01'::date;
-- date
--------------
-- 2013-01-01
select 1 / 10 as non_casted, 1::float8 / 10 as casted;
-- non_casted | casted
@rebcabin
rebcabin / gist:5657986
Last active January 8, 2016 14:40
Rx LINQ Operator Precis
Rx LINQ Operator Precis
Brian Beckman, May 2013
================================================================================
Introduction
================================================================================
This is a highly abbreviated "cheat-sheet" for the LINQ operators over Rx, the
Reactive Extensions. Its purpose is to TEACH by laying bare the regular and
tasteful structure of the API. This structure can be difficult to perceive from
ordinary documentation and source code because comparable and contrastable
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active August 27, 2025 08:37
A badass list of frontend development resources I collected over time.
@bradley-holt
bradley-holt / calendar-of-tech-events.md
Last active December 22, 2015 20:28
A collection of community tech events in the greater Burlington area.
@tjnurmin
tjnurmin / Heat map colors
Last active July 17, 2021 23:44
Generate heat map colors through interpolation
// declare start, mid, end colors
$c = array(
array(0,0,0),
array(128,128,128),
array(255,255,255)
);
$loops = 127;
for ($t = 0; $t <= $loops; $t++)
@joyrexus
joyrexus / README.md
Last active August 1, 2025 10:41 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})