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 | |
def selekt | |
inject({}) {|hsh,(k,v)| | |
hsh[k] = v if yield(k,v) | |
hsh | |
} | |
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
# Rackup file for serving up a static site from a "public" directory | |
# | |
# Useful for chucking a static site on Heroku | |
class IndexRewriter | |
def initialize(app) @app = app end | |
def call(env) | |
env["PATH_INFO"].gsub! /\/$/, '/index.html' | |
@app.call(env) | |
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
#!/usr/bin/env ruby | |
# A couple of Searchlogic searches. Both are identical from a code | |
# perspective. With one, the user supplies a '.' (period) as part of the | |
# search query. This search blows up because it's generating an invalid SQL | |
# statement. I say it shouldn't. The error in question is: | |
# | |
# Mysql::Error: Not unique table/alias: 'users': | |
# | |
# SELECT `companies`.`id` AS t0_r0, |