Skip to content

Instantly share code, notes, and snippets.

View gautamarora's full-sized avatar

Gautam Arora gautamarora

  • Los Angeles, CA
View GitHub Profile
@gautamarora
gautamarora / index.js
Last active September 19, 2016 18:21
requirebin sketch
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) {
@gautamarora
gautamarora / backbone.js
Last active August 29, 2015 14:18
Learning Backbone
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'
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
@gautamarora
gautamarora / textmate markdown bundle - 'convert document to html and save' command
Created May 4, 2012 05:29
simple edit to the convert command in textmate markdown bundle to save the generated html as a .html file in same dir
# 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;