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
module Merb | |
module GlobalHelpers | |
def include_templates | |
rv = '<div style="display: none;" class="jqt-templates">' | |
rv += glob_dir("#{Merb.root}/app/views/shared").join | |
rv += glob_dir("#{Merb.root}/app/views/#{controller_name.downcase}").join | |
rv + '</div>' | |
end | |
private |
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
module Merb | |
def self.cache | |
Merb::Controller._cache.store | |
end | |
end | |
class Merb::Cache::MemcacheStore | |
def fetch(key, options = {}) | |
if !options[:force] && value = cache_get(key) | |
value |
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
let's make a list of sinatra-based apps! | |
apps: | |
- 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>. See in action @ www.restafari.org" | |
- http://github.com/ichverstehe/gaze "Serve up your Markdown files with this tiny Sinatra 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
chrome://net-internals/#events&q=type:SPDY_SESSION%20is:active |
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 Hash | |
# traverse a nested hash, yielding keypath and value | |
def walk(path = [], &block) | |
self.each do |k,v| | |
path.push(k) | |
v.is_a?(Hash) ? v.walk(path, &block) : yield(path, v) | |
path.pop | |
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
class Object | |
def interesting_methods | |
case self.class | |
when Class | |
self.public_methods.sort - Object.public_methods | |
when Module | |
self.public_methods.sort - Module.public_methods | |
else | |
self.public_methods.sort - Object.new.public_methods | |
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
# prepend the mime type suggested by the path_info extname to the Accept: header, | |
# and pass on the request with suffix removed | |
module Rack | |
class SuffixAccept | |
def initialize(app) | |
@app = app | |
end | |
def call(env) |