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 following_pages | |
twitter_user.friends_count.to_i / 100 + 1 | |
end | |
def following | |
@following ||= (1..following_pages).map do |i| | |
twitter.friends_for(uid, :page => i, :lite => true) | |
end.flatten | |
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
# Originally from http://www.benlog.org/2008/6/29/bare-bones-date-picker-for-merb | |
# Modified for new Merb 0.9.6 helpers | |
module Merb::Helpers::Form | |
def date_field(*args) | |
if bound?(*args) | |
current_form_context.bound_date_field(*args) | |
else | |
current_form_context.unbound_date_field(*args) | |
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
def star_sign | |
# 1980 is a leap year, so we're safe for Feb 29 people | |
# date ranges are according to wikipedia | |
case Date.new(1980, birthday.month, birthday.day) | |
when Date.new(1980, 1, 21)..Date.new(1980, 2, 18): "Aquarius" | |
when Date.new(1980, 2, 19)..Date.new(1980, 3, 20): "Pisces" | |
when Date.new(1980, 3, 21)..Date.new(1980, 4, 20): "Aries" | |
when Date.new(1980, 4, 21)..Date.new(1980, 5, 21): "Taurus" | |
when Date.new(1980, 5, 22)..Date.new(1980, 6, 21): "Gemini" | |
when Date.new(1980, 6, 22)..Date.new(1980, 7, 22): "Cancer" |
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
Using ~ instead of = for the content catch to | |
preserve whitespace indentation levels (since | |
I'm using preformatted code blocks) | |
This is actual code from http://blog.tracefunc.com, | |
powered by Webby |
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
# # of iterations = 10000 | |
# Rehearsal ------------------------------------------------------- | |
# null_time 0.000000 0.000000 0.000000 ( 0.002980) | |
# erubis 0.680000 0.010000 0.690000 ( 0.689765) | |
# builder 1.040000 0.010000 1.050000 ( 1.055823) | |
# erector 1.360000 0.000000 1.360000 ( 1.373215) | |
# tagz 2.420000 0.020000 2.440000 ( 2.453186) | |
# haml 7.090000 0.030000 7.120000 ( 7.196357) | |
# markaby 9.680000 0.040000 9.720000 ( 9.824390) | |
# --------------------------------------------- total: 22.380000sec |
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
set PATH ~/bin $PATH | |
if test -d /opt/local/lib/mysql5/bin/ | |
# include OSX mysql from macports | |
set PATH $PATH /opt/local/lib/mysql5/bin/ | |
end | |
# OSX tweaks | |
if set -q Apple_PubSub_Socket_Render | |
# bind \cleft and \cright | |
bind \e\[5D prevd-or-backward-word |
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 'activesupport' | |
require 'restclient' | |
require 'hpricot' | |
module Hoptoad | |
class API | |
attr_accessor :dirty | |
def initialize(base, token) |
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
Date/Time: 2009-12-23 14:15:07 -0500 | |
OS Version: 10.6.2 (Build 10C540) | |
Architecture: x86_64 | |
Report Version: 6 | |
Command: TextMate | |
Path: /Users/jamie/Applications/TextMate.app/Contents/MacOS/TextMate | |
Version: 1.5.9 (1510) | |
Parent: launchd [87] |
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
Analysis of sampling TextMate (pid 36589) every 1 millisecond | |
Call graph: | |
7843 Thread_280040 DispatchQueue_1: com.apple.main-thread (serial) | |
7843 start | |
7843 _start | |
7843 NSApplicationMain | |
7843 -[NSApplication run] | |
7843 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] | |
7843 _DPSNextEvent | |
7843 BlockUntilNextEventMatchingListInMode |
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
I like the :symbol.comparison syntax, but it looks like | |
I can't use DataMapper and MongoMapper in the same project. :( |
OlderNewer