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
It would be nice to have a browser native delay function that added | |
a function to the call stack to be run immediately, but not blocking | |
UI, similar to | |
> setTimeout(func, 0). | |
Currently prototype does this - prototype.function.defer sets a | |
timeout of 0.01. | |
In my experience though, setting a timeout has a delay - Resig'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
/* | |
* returns [{opts}, [args]] | |
*/ | |
var optParse = function(argv){ | |
var opts = {} | |
, args = [] | |
for(var i in argv){ | |
var x = argv[i] | |
if (x[0] == '-'){ |
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
Date.prototype.toLocalISOString = function(){ | |
// ISO 8601 | |
var d = this | |
, pad = function (n){return n<10 ? '0'+n : n} | |
, tz = d.getTimezoneOffset() //mins | |
, tzs = (tz>0?"-":"+") + pad(parseInt(tz/60)) | |
if (tz%60 != 0) | |
tzs += pad(tz%60) | |
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
/* | |
* HTML Highlighter | |
*/ | |
(function($){ | |
$.fn.highlight = function(words, options){ | |
var elements = $(this) | |
, settings = { | |
className: 'highlight' | |
, caseSensitive: false | |
} |
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
int incomingByte = 0; | |
int prev = 0; | |
int RED = 13; | |
int ORANGE = 12; | |
int GREEN = 11; | |
void setup() { | |
pinMode(RED, OUTPUT); | |
pinMode(ORANGE, OUTPUT); |
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
var sys = require('sys') | |
var tests = [] | |
exports.runTest= function(t, browser, cb){ | |
var err = function(e){ | |
sys.print('E') | |
console.log("\n Error: ", t[1], ">>> ", e.name, e.message, '\n', e.stack) | |
cb() |
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
// ==UserScript== | |
// @name pb-fb | |
// @namespace fb | |
// @description fb | |
// @include https://www.facebook.com/ | |
// ==/UserScript== | |
document.getElementById("blueBar").style.setProperty("position", "absolute", "important"); | |
var _findByVal = function(tag, val, cb){ |
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
var cv = require('opencv') | |
var im = new cv.Image("./examples/test.jpg") | |
, face_cascade = new cv.CascadeClassifier("./examples/haarcascade_frontalface_alt.xml") | |
var faces = face_cascade.detectMultiScale(im, function(err, faces){ | |
for (var i=0;i<faces.length; i++){ | |
var x = faces[i] | |
im.ellipse(x.x + x.width/2, x.y + x.height/2, x.width/2, x.height/2); | |
} |
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
var s = new cv.ImageStream(); | |
fs.createReadStream('./examples/mona.jpg').pipe(s); | |
// --- | |
cv.ImageStream = function(){ | |
this.data = Buffers([]) | |
} |
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
var cv = require('opencv') | |
new cv.VideoCapture(0).read(function(mat){ | |
mat.resize(200,100) | |
mat.detectObject("./data/haarcascade_frontalface_alt.xml", {min : [30,30]}, function(err, faces){ | |
for (var i=0;i<faces.length; i++){ | |
var x = faces[i] | |
mat.ellipse(x.x + x.width/2, x.y + x.height/2, x.width/2, x.height/2); |
OlderNewer