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
(function(){ | |
// Define your class. | |
return( Singleton || Constructor ); | |
})(); |
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
# Patch for ransack (https://github.com/ernie/ransack) to use scopes | |
# Helps migrating from Searchlogic or MetaSearch | |
# Place this file into config/initializer/ransack.rb of your Rails 3.2 project | |
# | |
# Usage: | |
# class Debt < ActiveRecord::Base | |
# scope_ransackable :overdue | |
# scope :overdue, lambda { where(["status = 'open' AND due_date < ?", Date.today]) } | |
# 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 self.memoize_with_memcache(name) | |
define_method "#{name}_with_memo" do | |
key = [self.class.name, id.to_s] * '/' | |
Cache.get(key) || Cache.put(key, name_without_memo) | |
end | |
alias_method_chain name.to_sym, :memo #needs :to_sym here, otherwise 'name' is unrecognized | |
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
Let's make a list of Sinatra-based apps! | |
Apps: | |
- http://github.com/cawel/ric-rac-roe "The classic tic-tac-toe game" | |
- http://github.com/cschneid/irclogger "Sinatra based irclogger.com" | |
- http://github.com/rtomayko/wink "minimalist blogging engine" | |
- http://github.com/foca/integrity "The easy and fun Continuous Integration server" | |
- http://github.com/sr/git-wiki "git-powered wiki" | |
- http://github.com/entp/seinfeld "Seinfeld-inspired productivity calendar to track your public github commits." | |
- http://github.com/karmi/marley "Marley, the blog engine without <textareas>." |
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
Shoes.app :width => 300, :height => 300 do | |
@squares = [] | |
(1..9).each do |n| | |
stack :width => 100, :height => 100 do | |
@squares[n] = image "1.gif" do | |
@squares[n] = image "2.gif" | |
end | |
end | |
end | |
end |