View gist:2934621
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
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"); | |
} | |
} | |
} |
View D3 setup
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 svg = d3.select("svg"); | |
svg.se |
View jsdom.js
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
// 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>", |
View scan.coffee
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
# 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") |
View boxmodel-css-paul-irish
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
/* apply a natural box layout model to all elements */ | |
* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } | |
@paulirish | |
/* | |
recommendation for | |
IE8 and up | |
*/ |
View beat.gibber
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
d = Drums("xooxox",1/6); |
View cors.js
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 createCORSRequest(method, url) { | |
var xhr = new XMLHttpRequest(); | |
if ("withCredentials" in xhr) { | |
// Check if the XMLHttpRequest object has a "withCredentials" property. | |
// "withCredentials" only exists on XMLHTTPRequest2 objects. | |
xhr.open(method, url, true); | |
} else if (typeof XDomainRequest != "undefined") { |
View new_gist_file
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
window.parent.$("body").animate({scrollTop:0}, 'slow'); |
View gist:5877343
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
diff --git a/server/package.json b/server/package.json | |
index e8da09d..37ff4ef 100644 | |
--- a/server/package.json | |
+++ b/server/package.json | |
@@ -5,7 +5,7 @@ | |
"main": "index.js", | |
"scripts": { | |
"test": "grunt", | |
- "start": "node app/app.js" | |
+ "start": "node app.js" |
View bashrc.bash
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
# first ln -s ~/.bashrc ~/.bash_profile | |
# then | |
#Git tab completion | |
# source ~/git-completion.bash | |
# Show branch in status line | |
# PS1='[\W$(__git_ps1 " (%s)")]\$ ' | |
# export PROMPT_COMMAND='echo -ne "\033]0;${PWD/#$HOME/~}\007"' | |
# Git branch in prompt. | |
parse_git_branch() { |
OlderNewer