This file contains hidden or 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
+-----------------------------+ | |
| ^^^^ / ~| | |
| ^^^ --------- /| | |
| ^^ Simple / -------- | | |
| / ~ / ** | | |
| / / **** | | |
| ---- ~ / ****** | | |
| / ~~ ---- ****** | | |
| / / **** | | |
| / ~~ / ⌂⌂⌂⌂| |
This file contains hidden or 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
get '/' do | |
@stories = Dir.glob("#{stories_root}/*").map {|q| q.gsub!(/^.*\//,"") } | |
erb <<-HTML | |
<ul> | |
<% @stories.each do |story| %> | |
<li><a href="/<%= story %>"><%= story %></a></li> | |
<% end %> | |
</ul> | |
HTML |
This file contains hidden or 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 endpoint(query) | |
tokens = [ | |
"XXXXX", | |
"YYYYY" | |
] | |
URI.encode "https://graph.facebook.com/search?q=#{query}&type=user&access_token=#{tokens[rand(2)]}" | |
end |
This file contains hidden or 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 TumblrOauth | |
class Client | |
def initialize(options = {}) | |
@consumer_key = options[:consumer_key] | |
@consumer_secret = options[:consumer_secret] | |
@token = options[:token] | |
@secret = options[:secret] | |
@proxy = options[:proxy] | |
end |
This file contains hidden or 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
$ curl "https://api.twitter.com/1/urls/resolve.json?urls\[\]=http://t.co/CZuUXUK6" -H "X-Phx:true" |
This file contains hidden or 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
require 'rubygems' | |
require 'rest-client' | |
g = "http://go" | |
o = "o" | |
loop do | |
url = g + o + "gle.com" | |
p "trying " + url | |
p RestClient.get(url).headers |
This file contains hidden or 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
# the ruby way | |
def slot_tag(name, &blk) | |
slot_article = Slot.find_by_name(name).article | |
blk.call slot_article | |
end | |
# the yehuda katz way | |
def slot_tag(name, &blk) | |
slot_article = Slot.find_by_name(name).article | |
capture slot_article, &blk |
This file contains hidden or 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 ap_less_than_10(number) | |
lookup = { | |
1 => "one", | |
2 => "two", | |
3 => "three", | |
4 => "four", | |
5 => "five", | |
6 => "six", | |
7 => "seven", | |
8 => "eight", |
This file contains hidden or 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 hasPermission = function(uid, cb) { | |
// are we allowed to publish to the user's wall? | |
var perm = "publish_stream"; | |
var query = FB.Data.query('select ' + perm + ' from permissions where uid={0}', uid); | |
query.wait(function(rows) { cb(rows[0][perm]); }); // returns 1 or 0 | |
} |
This file contains hidden or 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
$ curl -I http://t.co/a87DAaC | |
HTTP/1.1 301 Moved Permanently | |
Date: Sat, 20 Aug 2011 22:53:39 GMT | |
Server: hi | |
Location: http://nyti.ms/p8ZGNT | |
Cache-Control: private,max-age=300 | |
Expires: Sat, 20 Aug 2011 22:58:39 GMT | |
Connection: close | |
Content-Type: text/html; charset=UTF-8 |