👨👩👧👦
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
// Iterations, anyone? AKA | |
// How I wrote a walk_dom method. | |
// | |
// A JavaScript poem by | |
// | |
// "Cowboy" Ben Alman | |
// 11/21/2009 | |
// A starting point. |
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
|____app | |
| |____downloader.js | |
| |____editor.js | |
| |____hotkeys.js | |
| |____search_parser.js | |
| |____workspace.js | |
|____application.js | |
|____ie | |
| |____excanvas.js | |
|____lib |
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
[02:38] jashkenas: ryah: if you're around now, I'd be very curious to hear your thoughts on Steve Dekorte's comparison of a Node.js/callback proxy versus an Io/coros proxy: | |
[02:38] jashkenas: Node: http://www.iolanguage.com/paste/p/f05588fa6.html | |
[02:38] jashkenas: Io: http://www.iolanguage.com/paste/p/2f7b5fce1.html | |
[02:39] maqr: jashkenas: my plan is to make a little tool for tumblr theme developers to push up their latest work, rather than having to use tumblr's web interface, if you were wondering :) | |
[02:39] mjr_: I noticed that one has fewer lines. | |
[02:39] jashkenas: maqr: fun. | |
[02:39] maqr: ryah: oh ok, all the buzz i hear is about how it's X times faster than a normal webserver | |
[02:39] maqr: and i'm not sure what "evented I/O for V8" really means yet :) | |
[02:40] jashkenas: mjr_: I think that the question is more about whether we're comfortable and settled on writing out the explicit callback form, longhand. Or if it seems like there's room for improvement with this example (coros or not). | |
[02:40] Tim_S |
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
# Create the web server. | |
server: http.createServer (req, res) -> | |
params: url.parse req.url, true | |
if params.pathname is '/pixel.gif' | |
res.writeHead 200, pixelHeaders | |
res.end pixel | |
else | |
res.writeHead 404, emptyHeaders | |
res.end '' | |
record params |
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
if Rails.env.development? | |
around_filter :perform_profile | |
end | |
# In development mode, optionally perform a RubyProf profile of any request. | |
# Simply pass perform_profile=true in your params. | |
def perform_profile | |
return yield unless params[:perform_profile] | |
require 'ruby-prof' | |
RubyProf.start |
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 ArrayProto = Array.prototype | |
, ObjProto = Object.prototype | |
; | |
// Array Tests | |
["forEach", "map", "reduce", "reduceRight", "filter", "every", "some", | |
"indexOf", "lastIndexOf"].forEach(function(key){ | |
var d = document.createElement("div"); | |
d.textContent = key + ": " + ArrayProto[key]; | |
document.body.appendChild(d); | |
}); |
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
ALNUM = /[a-z0-9]/i | |
PUNCT = /[^a-z0-9\s]/i | |
REPEAT = /(.)\1{2,}/ | |
UPPER = /[A-Z]/ | |
LOWER = /[a-z]/ | |
ACRONYM = /^[A-Z]+('?s|[.,])?$/ | |
ALL_ALPHA = /^[a-z]+$/i | |
CONSONANT = /[bcdfghjklmnpqrstvwxz]/i | |
VOWEL = /[aeiouy]/i | |
CONSONANT_5 = /[bcdfghjklmnpqrstvwxz]{5}/i |
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
module ProPublica | |
class GoogleComparer | |
BASE_URL = "https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=" | |
WEB_TITLE_DELIMITERS = /(-|\|).*$/ | |
def initialize(facility_name) | |
@facility_name = facility_name | |
url_encoded_facility_name = CGI.escape(@facility_name) | |
@results = JSON.parse(RestClient.get(BASE_URL + url_encoded_facility_name))['responseData']['results'] | |
end |
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
.infinite_frowns { | |
color: #660000; | |
background: #FFEEEE; | |
} | |
.infinite_smiles { | |
color: #000; | |
background: #CCFFCC; | |
} |
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 import(stat, &blk) | |
puts "trying #{stat}" | |
begin | |
block_given? ? blk.call : Object.const_get(stat).import(@date) | |
rescue GatticaError => exception | |
puts "*** got a GA error: #{exception} ***" | |
sleep 10 | |
retry | |
end | |
end |
OlderNewer