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
-- | |
-- lena.lua | |
-- | |
-- | |
-- work queue operations | |
queue = {} |
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
/* | |
* a smart poller for jquery. | |
* (by github) | |
* | |
* simple example: | |
* | |
* $.smartPoller(function(retry) { | |
* $.getJSON(url, function(data) { | |
* if (data) { | |
* doSomething(data) |
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
#content | |
.left.column | |
%h2 Welcome to our site! | |
.right.column | |
#users | |
{{#users}} | |
%p {{user}} | |
{{/users}} |
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 allows culerity to wait until all ajax requests have finished | |
jQuery(function($) { | |
var original_ajax = $.ajax; | |
var count_down = function(callback) { | |
return function() { | |
try { | |
if(callback) { | |
callback.apply(this, arguments); | |
}; | |
} catch(e) { |
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
#!/usr/bin/env ruby | |
# | |
# Discover the contribution status of a user for all their watched repos: owner, collaborator, or watcher | |
# Returns either JSON (default) or HTML (example http://github-user-profiles-example.heroku.com/) | |
# | |
# JSON: Returns either Array of JSON; or streams each JSON result as discovered (--stream flag) | |
# { "repo" => { ... }, "owner" => is project owner?, "collaborator" => has collaborator access? } | |
# | |
# HTML: Sort-of pretty HTML output. Nice to use --stream | bcat. | |
# |
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
I make this beer a couple times a year, and it is usually gone quickly. It is probably my favorite beer. | |
8 pounds light malt extract syrup | |
3 pounds raw, natural honey | |
1 pound Crystal 40 grain | |
2 oz Fuggles hops | |
2 Edinburgh Ale yeast | |
Typical extract procedure: |
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
{ | |
"Statement":[{ | |
"Effect":"Allow", | |
"Action":["s3:ListBucket","s3:GetObject","s3:GetObjectVersion"], | |
"Resource":["arn:aws:s3:::my_bucket/*","arn:aws:s3:::my_bucket"] | |
} | |
], | |
"Statement":[{ | |
"Effect":"Allow", | |
"Action":["s3:ListBucket","s3:GetObject","s3:GetObjectVersion"], |
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
body = MultipartBody.new(:field1 => 'test', :field2 => 'test2') | |
http = EventMachine::HttpRequest.new('http://example.com').post( | |
:head => {'content-type' => "multipart/form-data; boundary=#{body.boundary}"}, | |
:body => body.to_s | |
) | |
# Or with a file part included | |
part1 = Part.new('name', 'content', 'file.txt') |
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 false | |
elsif | |
print "hi " | |
else | |
puts "mom" | |
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
connection = Faraday::Connection.new('http://example.com') do |builder| | |
builder.request :url_encoded # for POST/PUT params | |
builder.adapter :net_http | |
end | |
# same as above, short form: | |
connection = Faraday.new 'http://example.com' | |
# GET | |
connection.get '/posts' |
OlderNewer