Skip to content

Instantly share code, notes, and snippets.

View dviramontes's full-sized avatar
〰️
/* speed operator */

David Viramontes dviramontes

〰️
/* speed operator */
View GitHub Profile
# emulates "nrmwyoldrmtob".scan(/.{1,5}/)
# encodes 5 char words and then some
class A
@replace = (str)->
str.match(/[a-z|0-9]{5}|[\w]+/ig).join(" ")
test= A.replace("nrmwyoldrmtob")
@dviramontes
dviramontes / jsdom.js
Created April 1, 2013 16:11
Screen Scraping with jsdom and node.js technique: http://blog.nodejitsu.com/jsdom-jquery-in-5-lines-on-nodejs
// The code creates a new jsdom window
// and adds jQuery to the document via a script element.
// Although it is just an illustrative
// example it is easy to modify it to work with
// real pages retrieved from the Internet.
var jsdom = require('jsdom');
jsdom.env({
html: "<html><body></body></html>",
@dviramontes
dviramontes / D3 setup
Created April 1, 2013 05:38
Tributary inlet
var svg = d3.select("svg");
svg.se
@dviramontes
dviramontes / gist:2934621
Created June 15, 2012 04:04
keyboard keycodes in processing.js
p5.keyPressed = function() {
if(p5.keyCode == p5.BACKSPACE ){
console.log("backspace was pressed");
}else if(p5.keypressed){
if(p5.key == 'c'){
console.log("c was pressed");
}
}
}