This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(typeof Array.prototype.pushHeap !== "function"){ | |
Array.prototype.pushHeap = function(v){ | |
//add item to the end. this is supposedly faster than pushing http://dev.opera.com/articles/view/efficient-javascript/?page=all | |
this[this.length]=v; | |
//update the index of v to show it's at the end of the array | |
this[this.length-1].i=this.length-1; | |
var h= Math.floor(this.length/2), | |
p = this[h-1], | |
vpos = this.length-1; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function $CLASS$() { | |
$END$ | |
} | |
;(function(proto){ | |
proto.method = function(){ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("$CLASS$", function(){ | |
it("should $END$", function(){ | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function drawVexNote(note){ | |
var renderer = new Vex.Flow.Renderer("note-canvas", Vex.Flow.Renderer.Backends.CANVAS); | |
var ctx = renderer.getContext(); | |
ctx.clear(); | |
var stave = new Vex.Flow.Stave(0, 0, 100); | |
stave.addClef("treble").setContext(ctx).draw(); | |
var vexNote = new Vex.Flow.StaveNote({ keys: [note.name+"/"+note.octave], duration: "w" }) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ "keys": ["super+d"], "command": "duplicate_line" }, | |
{ "keys": ["super+y"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} }, | |
{ "keys": ["super+alt+up"], "command": "swap_line_up" }, | |
{ "keys": ["super+alt+down"], "command": "swap_line_down" } | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sequel' | |
require 'json' | |
require 'pg' | |
DB_central = Sequel.connect('postgres://xxx:xxx@hostname/central_db') | |
DB_client1 = Sequel.connect('postgres://xxx:xxx@hostname/client1_db') | |
DB_central.listen :usersupdate, {loop: true} do |channel, pid, payload| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION send_notification() RETURNS trigger AS $$ | |
BEGIN | |
PERFORM pg_notify('usersupdate', | |
(SELECT row_to_json(r.*)::varchar FROM ( | |
SELECT id, email, name from users where id = NEW.id) | |
r) | |
); | |
RETURN NEW; | |
END; | |
$$ LANGUAGE plpgsql; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mongoDate(mongoId){ | |
var timehex = mongoId.substring(0,8); | |
var secondsSinceEpoch = parseInt(timehex, 16); | |
return new Date(secondsSinceEpoch * 1000); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# get the last sucessful build | |
XML=`curl http://localhost:8080/job/External-Monitoring/lastSuccessfulBuild/api/xml` | |
# extract the first 10 digits of the timestamp | |
TIMESTAMP=`echo $XML| sed -E 's/.*timestamp>(.*)\<\/timestamp.*/\1/' | cut -c1-10` | |
NOW=`date +"%s"` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <MIDI.h> | |
byte pedal = 4; | |
byte bassDrum = 8; | |
byte snareDrum1 = 9; | |
byte snareDrum2 = 10; | |
byte snareAlternate = true; | |
byte bassDrumPitch = 36; | |
byte snareDrumPitch = 38; |
OlderNewer