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
# app:sync | |
# Local and production synchronization | |
# - require yaml_db plugin | |
namespace :app | |
namespace :sync do | |
task :all => [:files, :db] | |
task :files do | |
`rsync -azv user@host:'/apps/myawesomeapp/shared/files/' #{Rails.root + 'files'}` |
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 :restrict do | |
method_name = "has_many_dependent_restrict_for_#{reflection.name}".to_sym | |
define_method(method_name) do | |
unless send(reflection.name).empty? | |
# change to named error... | |
raise ActiveRecord::StatementInvalid, "can't delete record because of dependent #{reflection.name}" | |
end | |
end | |
before_destroy method_name | |
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
./configure \ | |
--prefix=/usr/local/php5.3 \ | |
--mandir=/usr/local/share/man \ | |
--infodir=/usr/local/share/info \ | |
--with-config-file-path=/usr/local/etc \ | |
--enable-calendar \ | |
--with-iconv=/opt/local \ | |
--enable-exif \ | |
--enable-ftp \ | |
--enable-wddx \ |
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 File.dirname(__FILE__) + '/../../vendor/gems/net-dns-0.4/lib/net/dns/resolver' | |
# Custom Domain | |
# A Rack middleware to to resolve the custom domain to original subdomain | |
# for your multi telent application. | |
# | |
# It's all transperant to your application, it performs cname lookup and | |
# overwrite HTTP_HOST if needed | |
# | |
# www.example.org => example.myapp.com |
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
<?php | |
class Proc extends Object { | |
public $block; | |
public $parameters; | |
function initialize($block) { | |
$parameters = func_get_args(); | |
$this->block = array_pop($parameters); |
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
var DateHelper = { | |
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time | |
// Ruby strftime: %b %d, %Y %H:%M:%S GMT | |
time_ago_in_words_with_parsing: function(from) { | |
var date = new Date; | |
date.setTime(Date.parse(from)); | |
return this.time_ago_in_words(date); | |
}, | |
time_ago_in_words: function(from) { |
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
namespace :svn do | |
desc 'Reads patterns from the .svnignore file in RAILS_ROOT and ignores them' | |
task :ignore => :environment do | |
# Set the svnignore filename and define the absolute path to that file | |
# | |
svnignore_path = File.join(RAILS_ROOT, '.svnignore') | |
# Ensure the svnignore file exists | |
# |
NewerOlder