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
require 'activesupport'; | |
cache = ActiveSupport::Cache::MemoryStore.new | |
cache.fetch(User.find(1)){User.find(1)} |
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 order_one_flows args = {} | |
height, width = (args[:height] || 100.0), (args[:width] || 100.0) | |
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
require 'rubygems' | |
require 'hpricot' | |
feed = 'data/input.feed' | |
h = Hpricot(File.read feed) | |
puts (h/'description')[1..-1].inner_html.map{|str| str.gsub('<','<')}.map{|str| str.gsub('>','>')}.map{|str| (Hpricot(str)/'img').map{|img| img.attributes['src']}.join("\n")}.join.gsub('"', '') |
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
require 'rubygems' | |
require 'vendor/sinatra/lib/sinatra.rb' | |
root_dir = Dir.pwd | |
Sinatra::Application.set( | |
:run => false, | |
:environment => 'production' | |
) | |
require 'app' |
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
# User specific | |
set move = no | |
set delete=yes | |
set editor="vim" | |
set include=yes | |
set fast_reply=yes | |
set record='Archive' | |
set sort = 'threads' | |
set sort_aux = 'reverse-last-date-received' |
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
db/*.sqlite3 | |
db/schema.rb | |
log/*log* | |
tmp/**/* | |
.DS_Store | |
doc/api | |
doc/app | |
*.tmproj |
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
# Copy and paste this to the rails console to test your email settings | |
class MyMailer < ActionMailer::Base | |
def test_email | |
@recipients = "[email protected]" | |
@from = "[email protected]" | |
@subject = "test from the Rails Console" | |
@body = "This is a test email" | |
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
/path/to/log/*.log { | |
compress | |
copytruncate | |
daily | |
dateext | |
delaycompress | |
missingok | |
notifempty | |
rotate 30 | |
sharedscripts |
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 Name | |
attr_read :first, :last | |
def initialize | |
load_data | |
end | |
private | |
def load_data | |
@first = 'SengMing' | |
@last = 'Tan' |
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 Name | |
def name | |
first + ' ' + last | |
end | |
def first | |
@first ||= 'SengMing' | |
end | |
def last |
OlderNewer