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 yo | |
send_push_notification("Yo") | |
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
def dispense_change(cents) | |
change = { "quarters" => 0, "dimes" => 0, "nickels" => 0, "pennies" => 0 } | |
number_of_quarters = cents / 25 | |
if number_of_quarters > 0 | |
change["quarters"] = number_of_quarters | |
end | |
cents = cents % 25 |
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 fibonacci(initial, limit = 100) | |
sum = initial[-1] + initial[-2] | |
initial << sum | |
if sum < limit | |
fibonacci(initial) | |
else | |
initial | |
end | |
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
/* | |
Play entrance music | |
*/ | |
/* defining a new responder is probably the best way to insulate your hacks from Campfire and Propane */ | |
Campfire.EntranceMusician = Class.create({ | |
initialize: function(chat) { | |
this.chat = chat; | |
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
Delivered-To: [email protected] | |
Received: by 10.229.219.3 with SMTP id hs3cs265930qcb; | |
Wed, 21 Jul 2010 11:15:58 -0700 (PDT) | |
Received: by 10.100.4.5 with SMTP id 5mr643369and.160.1279736156554; | |
Wed, 21 Jul 2010 11:15:56 -0700 (PDT) | |
Return-Path: <[email protected]> | |
Received: from o2.e2.kickstarter.com (o2.e2.kickstarter.com [74.63.202.49]) | |
by mx.google.com with SMTP id s1si17692517anc.34.2010.07.21.11.15.55; | |
Wed, 21 Jul 2010 11:15:55 -0700 (PDT) | |
Received-SPF: pass (google.com: domain of [email protected] designates 74.63.202.49 as permitted sender) client-ip=74.63.202.49; |
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 initialize(email=nil, password=nil) | |
05 @host = 'http://www.tumblr.com' | |
06 @action = '/login' | |
07 login(email, password) if email and password | |
08 end | |
09 | |
10 def login(email, password) | |
11 res = Net::HTTP.post_form(URI.parse(@host+@action),{'email'=> email, 'password'=> password }) | |
12 case res | |
13 when Net::HTTPSuccess |
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
class CommentsController < ApplicationController | |
include ApplicationHelper, StageHelper, CommentsHelper | |
before_filter :login_required | |
before_filter :setup_current_user | |
def create | |
case params[:type] | |
when "Photo" |
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 self.hot_objects(type, date) | |
objects = Photo.find_by_sql("SELECT id, title, points_count, filename, parent_id, sum(score) as fame FROM ( | |
SELECT photos.id, photos.title, photos.points_count, photos.filename, photos.parent_id, | |
COUNT(photos.id) * 5 as score | |
FROM `photos` LEFT JOIN comments ON comments.commentable_id = photos.id AND comments.commentable_type = 'Photo' AND photos.user_id != comments.user_id AND `photos`.`parent_id` IS NULL | |
WHERE (comments.created_at > '#{date}') GROUP BY photos.id | |
UNION | |
SELECT photos.id, photos.title, photos.points_count, photos.filename, photos.parent_id, | |
COUNT(photos.id) / 2 as score |
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
body | |
{ | |
background-color:black; | |
color:white; | |
font-family: Georgia, serif; | |
font-size: 16px; | |
font-style: normal; | |
font-weight: normal; | |
text-transform: normal; | |
letter-spacing: normal; |
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 language="javascript"> | |
function checkScroll(url) { | |
if (nearBottomOfPage()) { | |
currentPage++; | |
new Ajax.Request(url+'page='+currentPage, {asynchronous:true, evalScripts:true, method:'get'}); | |
} else { | |
setTimeout("checkScroll('"+url+"')", 250); | |
} | |
} | |
document.observe('dom:loaded', checkScroll); |