This file contains 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
#!/usr/bin/env ruby | |
require 'net/imap' | |
# Source server connection info. | |
SOURCE_HOST = 'mail.example.com' | |
SOURCE_PORT = 143 | |
SOURCE_SSL = false | |
SOURCE_USER = 'username' | |
SOURCE_PASS = 'password' | |
This file contains 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 remove_textile_and_html(text) | |
textilize(text).gsub(/<\/?[^>]*>/, "") | |
end |
This file contains 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 Foo | |
def bar | |
"test" | |
end | |
end |
This file contains 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
# load libraries | |
require 'rubygems' | |
require 'wirble' | |
require 'pp' | |
alias q exit | |
# Easily print methods local to an object's class | |
class Object | |
def local_methods |
This file contains 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 Test::Unit::TestCase | |
def self.should_have_default_scope(scope_call, find_options = nil) | |
klass = model_class | |
matcher = have_default_scope(scope_call).finding(find_options) | |
should matcher.description do | |
assert_accepts matcher.in_context(self), klass.new | |
end | |
end | |
end |
This file contains 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
# Back up your iTunes library to S3 | |
git clone git://github.com/sstephenson/mackerel.git | |
ruby -rubygems mackerel/examples/itunes_backup.rb amazon-s3://YOUR_ACCESS_KEY_ID:[email protected]/YOUR_BUCKET_NAME/itunes.mackerel |
This file contains 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
# Lo-fi client for the Facebook API. E.g.: | |
# | |
# fb = FacebookClient.new(:api_key => 'api-key', :secret => 'secret') | |
# fb.call 'users.getInfo', :session_key => 'session-key', :uids => 'user-id', :fields => 'birthday' | |
# | |
class FacebookClient | |
def initialize(default_params={}) | |
@default_params = default_params.reverse_merge({ | |
:rest_server => 'http://api.new.facebook.com/restserver.php', | |
:format => 'JSON', |
This file contains 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
formatted_time_accessor :occurs_at, :occurs_until |
This file contains 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
// JQuery - Make all external links open in new tab/window | |
// Mashup of: | |
// http://travisroberts.tumblr.com/post/595428703/jquery-external-links-open-new-window | |
// http://snipplr.com/view.php?codeview&id=29949 | |
$(document).ready(function() { | |
$("a[href*='http://']:not([href*='"+location.hostname+"'])").click( function() { | |
window.open( $(this).attr('href') ); | |
return false; | |
}); |
This file contains 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
<theme> | |
<!-- Window Style --> | |
<color id="foreground" red="1.0" green="0.776" blue="0.427" alpha="1.0" /> | |
<color id="background" red="0.255" green="0.255" blue="0.255" alpha="1.0" /> | |
<window foregroundColorID="foreground" backgroundColorID="background" shouldUseHUDScrollers="no" /> | |
<!-- Text View Style --> | |
<color id="tag" red="0.800" green="0.471" blue="0.200" alpha="1.0" /> | |
<color id="handle" extendsColorID="foreground" /> | |
<color id="insertionPoint" red="1.0" green="1.0" blue="1.0" alpha="1.0" /> |
OlderNewer