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 test = require('tape'); | |
function bouncer(age) { | |
if(age < 0) { | |
return("Come back once you're out of the womb"); | |
} | |
if(age < 18) { | |
return('Sorry, you are not old enough to enter the venue'); | |
} | |
if(age === 21) { |
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 todo = new Todo({text:"learning backbone"}); //creates new todo | |
todo.toJSON() //logs todo as json object | |
JSON.stringify(todo) //logs todo as json string | |
todo.get("text") //get value of attribute | |
todo.set({done: true}) //set value of attribute. note: this fires 'todo:change:done' & 'todo:change' |
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
def url = "http://search.twitter.com/search.json?q=java&rpp=5&include_entities=true&result_type=mixed" | |
def result = new JsonSlurper().parse(new BufferedReader(new InputStreamReader(new URL(url).openStream()))) | |
println result.results[0].text | |
println "@" + result.results[0].from_user |
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
# This command works well when you use the TextMate service from a | |
# web-log editor like Ecto or MarsEdit. You can write in markdown | |
# and then convert back to html before save and close. | |
HTML4=$([ -n "$TM_XHTML" ] || echo '--html4tags') | |
"${TM_MARKDOWN:-Markdown.pl}" $HTML4 > "$TM_FILENAME".html|"${TM_SMARTYPANTS:-SmartyPants.pl}"|perl -pe ' | |
# make <h1>Header</h1> into <h1 id="header">Header</h1> | |
# so that we can link to page#header | |
if(($tag, $title) = /<(h[1-6])>(.*?)<\/\1>/) { | |
$_ = $title; |