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
# lib/forgery_protection_helpers.rb | |
module ForgeryProtectionHelpers | |
def without_forgery_protection | |
return unless block_given? && respond_to?(:controller) | |
original_value = controller.allow_forgery_protection | |
controller.allow_forgery_protection = false | |
result = yield | |
controller.allow_forgery_protection = original_value | |
result | |
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
module I18n | |
def self.with_locale(locale) | |
old_locale, result = I18n.locale, nil | |
I18n.locale = locale | |
result = yield | |
I18n.locale = old_locale | |
result | |
end | |
def self.each_locale |
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
#!/usr/bin/php | |
<? | |
if ($argc < 3) { | |
error_log("Usage:\n\t" . __FILE__ . " newer-than-date path [path [path...]]"); | |
exit(1); | |
} | |
$accumulated_size_in_bytes = 0; | |
$newer_than_timestamp = strtotime($argv[1]); |
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
# environment variables for scripts and the like | |
export RAILS_ENV=production | |
# If not running interactively, don't do anything | |
[ -z "$PS1" ] && return | |
# don't put duplicate lines in the history. See bash(1) for more options | |
export HISTCONTROL=ignoredups | |
# ... and ignore same sucessive entries. | |
export HISTCONTROL=ignoreboth |
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
#!/usr/local/bin/php | |
<?php | |
$replacements = array( | |
"/:([^ ])/" => ": \$1", | |
"/(\\w)\\{/" => "\$1 {", | |
"/\\}\n([^\n])/" => "}\n\n\$1", | |
); | |
if ($argc < 2) { |
NewerOlder