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
######################################################################## | |
### Rakefile for encrypted passwords | |
######################################################################## | |
# | |
# Here's a little Rakefile to manage your encrypted password file! It's | |
# really easy to use: | |
# | |
# 1) put the email addresses of the keys you want in AUTHORIZED_USERS | |
# 2) create a passwords.txt (and ignore it in your SCM) | |
# 3) run `rake passwords:encrypt` |
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
# When anything, including nil, is a valid param and you need | |
# a clear way to know if a param was set or not. | |
def foo a, b = (b_was_not_passed = true; nil) | |
result = [a] | |
result << b unless b_was_not_passed | |
result | |
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
################################################################################ | |
### M E T H O D N A M E :: address ############################################ | |
### A R G U M E N T S :: separator[String] ################################## | |
### R E T U R N S :: String ############################################# | |
### A U T H O R :: Alan Smithee ####################################### | |
### D A T E :: 1989-10-31 ######################################### | |
################################################################################ | |
def address separator |
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 Intercession | |
def initialize app, behavior | |
@app = app | |
@behavior = behavior | |
@before, @after = %w(before after).map { |m| @behavior.instance_methods.map(&:to_s).include? m } | |
end | |
def call env | |
session = env["rack.session"] and session.extend @behavior |
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 "intercession" | |
require "myapp" | |
require "myapp/session_extras" | |
use Rack::Session::Cookie, :secret => "I'll punchasize your face for FREE!" | |
use Intercession, MyApp::SessionExtras | |
run MyApp |
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 JsonHax | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
if env['CONTENT_TYPE'] == 'application/json' | |
env['CONTENT_TYPE'] = 'application/xml' | |
env['REQUEST_URI'].gsub!(/\.json/, '.xml') |
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 "test_helper" | |
require "action_view/test_case" | |
class TestBusinessSearchHelpers < ActionView::TestCase | |
include BusinessSearchHelper | |
def test_format_address | |
{ | |
"Foo Goo 123" => "Foo Goo 123", |
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
(in /Users/drnic/newproj) | |
rake announce # publish # Announce your release. | |
rake check_extra_deps # deps # Install missing dependencies. | |
rake check_manifest # debug # Verify the manifest. | |
rake clean # # Clean up all the extras. | |
rake config_hoe # debug # Create a fresh ~/.hoerc file. | |
rake debug_email # publish # Generate email announcement file. | |
rake debug_gem # debug # Show information about the gem. | |
rake deps:email # deps # Print a contact list for gems dependent on this gem | |
rake deps:fetch # deps # Fetch all the dependent gems of this gem into tarballs |
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
RAILS_ROOT ||= ENV["RAILS_ROOT"] | |
namespace :bundle do | |
js_bundle = Rails.root + "/public/javascripts/bundle.js" | |
js_files = Dir[Rails.root + "/public/javascripts/{github,jquery}.*.js"].sort | |
task :all => [ js_bundle, :gist_js, :css ] | |
file js_bundle => js_files do |task| | |
require 'lib/js_minimizer' |
NewerOlder