Skip to content

Instantly share code, notes, and snippets.

@mrjf
mrjf / cause_error.coffee
Created July 20, 2012 00:18
Causes error: events.js:66 throw arguments[1]; // Unhandled 'error' event ^ Error: Parse Error at Socket.socketOnData (http.js:1356:20) at TCP.onread (net.js:404:27)
request = require 'request'
urls = ('123fastpay.com' for i in [1..35])
for url in urls
try
request 'http://' + url, (error, response, body) ->
console.log 'url is back:', response
catch error
console.log error
@mrjf
mrjf / gist:1228453
Created September 20, 2011 05:49
function arg options
# All compile to myfun(a, b, c, d);
myfun a, b, c, d
myfun a,
b,
c,
d
@mrjf
mrjf / assignment.coffee
Created September 20, 2011 05:26
assignment
$(document).ready ->
$("#file").mouseenter ->
$("#turn_in_box").css "border", "2px solid #D9D9D9"
$("#turn_in_box").css "background", "#D9D9D9"
$("#turn_in_box").css "color", "#393939"
$("#turn_in_box").css "cursor", "pointer"
$("#turn_in_box").css "box-shadow" ,"0px 0px 0px transparent"
$("#file").mouseleave ->
$("#turn_in_box").css "border", "2px solid #D9D9D9"
@mrjf
mrjf / test
Created September 10, 2011 21:28
Iterating over strings, looking up indices
str = 'abc'
arr = ['a', 'b', 'c']
for i in str
console.log "i: ", i
console.log "i + 1: ", i + 1
console.log "arr.indexOf(i + 1): ", arr.indexOf(i + 1)
console.log "arr.indexOf(i) + 1: ", arr.indexOf(i) + 1
console.log "\n"