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 Test::Unit::TestCase | |
alias_method :run_without_transaction, :run | |
def run(result) | |
exception = nil | |
Sequel::Model.db.transaction do | |
begin | |
run_without_transaction(result) | |
rescue => exception | |
# Capture exception, if raised |
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
# This relates to the issue described at: | |
# https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4709 | |
class String | |
def %(args) | |
if args.kind_of?(Hash) | |
dup.gsub(INTERPOLATION_PATTERN_WITH_ESCAPE) do |match| | |
if match == '%%' | |
'%' | |
else |
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
twttr.BANNED_PASSWORDS = ["111111","11111111","112233","121212","123123","123456","1234567","12345678","131313","232323","654321","666666","696969","777777","7777777","8675309","987654","aaaaaa","abc123","abc123","abcdef","abgrtyu","access","access14","action","albert","alexis","amanda","amateur","andrea","andrew","angela","angels","animal","anthony","apollo","apples","arsenal","arthur","asdfgh","asdfgh","ashley","asshole","august","austin","badboy","bailey","banana","barney","baseball","batman","beaver","beavis","bigcock","bigdaddy","bigdick","bigdog","bigtits","birdie","bitches","biteme","blazer","blonde","blondes","blowjob","blowme","bond007","bonnie","booboo","booger","boomer","boston","brandon","brandy","braves","brazil","bronco","broncos","bulldog","buster","butter","butthead","calvin","camaro","cameron","canada","captain","carlos","carter","casper","charles","charlie","cheese","chelsea","chester","chicago","chicken","cocacola","coffee","college","compaq","computer","cookie","cooper","corvette","cowbo |
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
# Force checking of /opt path for OS X macports binaries | |
if (File.exist?('/opt/local/bin/identify')) | |
Paperclip.options[:command_path] = '/opt/local/bin' | |
end | |
# Monkeypatch to get thumbnails working by allowing proper chaining | |
class Paperclip::Attachment | |
def callback(which) |
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
<IfModule mod_deflate.c> | |
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript | |
BrowserMatch ^Mozilla/4 gzip-only-text/html | |
BrowserMatch ^Mozilla/4\.0[678] no-gzip | |
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | |
Header append Vary User-Agent env=!dont-vary | |
</IfModule> |
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 ActionView | |
module Helpers | |
def write_asset_file_contents(joined_asset_path, asset_paths) | |
FileUtils.mkdir_p(File.dirname(joined_asset_path)) | |
File.atomic_write(joined_asset_path, File.join(Rails.root, 'tmp')) { |cache| cache.write(join_asset_file_contents(asset_paths)) } | |
# Set mtime to the latest of the combined files to allow for | |
# consistent ETag without a shared filesystem. | |
mt = asset_paths.map { |p| File.mtime(asset_file_path(p)) }.max |
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 | |
PASSPHRASE_CHARS = [ ?0..?9, ?A..?Z, ?a..?z ].collect { |c| c.collect }.flatten.collect { |c| "%c" % c } | |
cert_name = ARGV[0] | |
unless (cert_name) | |
print "Usage: genrsa <certname>" | |
exit(-1) | |
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
before_filter :load_${1:model}, :except => [ :index, :new, :create ] | |
before_filter :build_${1}, :only => [ :new, :create ] | |
def index | |
self.page_title << '${1/(^|_)(\w)/\U$2/g}s' | |
@${1}s = ${1/(^|_)(\w)/\U$2/g}.new_search(search_params) | |
end | |
def new |
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 globals(root = Module) | |
root.constants.collect do |name| | |
object = eval(name) rescue nil | |
if (object === Module || object === Class) | |
name | |
elsif (object.is_a?(Module) || object.is_a?(Class)) | |
globals(object).collect do |subname| | |
[ name, subname ].join('::') | |
end << name | |
else |
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 | |
# Replug hack | |
# - Local install of plugin | |
require 'rubygems' | |
# Rails Plugin Manager. | |
# | |
# Listing available plugins: |