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 'heroku' | |
USERNAME = '' | |
PASS = '' | |
APPNAME = '' | |
ADDON = 'pgbackups' | |
h = Heroku::Client.new(USERNAME, PASS) | |
h.install_addon(APPNAME, ADDON) |
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
# A script to write my Lover's 40th B-day present | |
require 'rubygems' | |
require 'prawn' | |
require 'rio' | |
# load up data from text file | |
Page = Struct.new(:content, :number) | |
items = rio('book.txt').read.split("\n") | |
pages = (items.size/2).times.collect{Page.new(items.pop, items.pop)}.reverse |
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
<script type="text/javascript"> | |
function streamPublish_<%= entry.id %>() { | |
var attachment = {name: "BrandX Contest", | |
description: "Vote for my entry and create your own picture!", | |
href: "<%= url_for "entries/#{entry.slug}" %>", | |
media: [{ | |
type: "image", | |
src: "<%= entry.amazon_public_url(:main) %>", | |
href: "<%= url_for "entries/#{entry.slug}" %>"} | |
]}; |
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 scrub(s) | |
s.gsub( /\W/, ' ') unless s.nil? | |
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
config.ru | |
map '/' do | |
run CountdownController | |
end | |
class CountdownController < Sinatra::Base | |
get '/' do | |
@sparse_view = 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
/** | |
* Loads the GIF file that facilitates analytics tracking. | |
*/ | |
private function loadAnalyticsImage(mode:String):void | |
{ | |
var pageLinkValue = encodeURIComponent('/'+(environment+mode)+'?uid='+uid+'&movid='+vid); | |
var ag = 'http://fbga.foofoo.net/fbga.php?googlecode=UA-197932-6&googledomain=facebook.com&pagetitle=' + (environment+mode) + '&pagelink=' + pageLinkValue; | |
//trace(ag); | |
var loader:Loader = new Loader(); | |
var request:URLRequest = new URLRequest(ag); |
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
{ | |
"97227": "134", | |
"97271": "123", | |
"24593": "221" | |
} |
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
mysql> select count(*) from users U join challenges C where C.level=10; | |
+----------+ | |
| count(*) | | |
+----------+ | |
| 7296 | | |
+----------+ | |
1 row in set (0.01 sec) | |
mysql> select count(*) from users U inner join challenges C on U.challenge_id = C.id where C.level=10; | |
+----------+ |
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
error_page 405 =200 @405; | |
location @405 { | |
root /data/budlight/current/public/; | |
} | |
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 'nokogiri' | |
class CommentCounter | |
def self.num_comments(params, xids) | |
count = 0 | |
facemask = Facemask.new(:api_key => ENV['FACEBOOK_API_KEY'], :session_key => params[:fb_sig_session_key], :secret_key => ENV['FACEBOOK_SECRET_KEY']) | |
xids.each do | xid | | |
result = facemask.post('facebook.comments.get', {:xid=>xid}) |
NewerOlder