Skip to content

Instantly share code, notes, and snippets.

View mjfreshyfresh's full-sized avatar

MJ mjfreshyfresh

View GitHub Profile
@mjfreshyfresh
mjfreshyfresh / heroku-install-addon.rb
Created May 4, 2011 17:04
demonstrating heroku exception when calling install_addon
require 'rubygems'
require 'heroku'
USERNAME = ''
PASS = ''
APPNAME = ''
ADDON = 'pgbackups'
h = Heroku::Client.new(USERNAME, PASS)
h.install_addon(APPNAME, ADDON)
# 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
<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}" %>"}
]};
def scrub(s)
s.gsub( /\W/, ' ') unless s.nil?
end
config.ru
map '/' do
run CountdownController
end
class CountdownController < Sinatra::Base
get '/' do
@sparse_view = true
/**
* 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);
{
"97227": "134",
"97271": "123",
"24593": "221"
}
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;
+----------+
error_page 405 =200 @405;
location @405 {
root /data/budlight/current/public/;
}
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})