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 change | |
add_column :table_name, :column_name, :column_type, default: 'default value' | |
remove_column :table_name, :column_name | |
rename_column :table_name, :old_name, :new_name | |
change_column :table_name, :column_name, :column_type | |
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
upstream app_name { | |
server 127.0.0.1:4000; #port examples | |
server 127.0.0.1:4001; | |
} | |
server { | |
server_name example.com; | |
listen 80; | |
access_log <acces_log_path>; | |
error_log <error_log_path; |
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 | |
# | |
tests = [ | |
{:name => "RSPEC", :command => "rake spec"}, | |
{:name => "JASMINE", :command => "jasmine-headless-webkit --color"} | |
] | |
tests.each do |test| | |
puts "\e[33mEXECUTING #{test[:name]} TESTS\e[0m" | |
test[:result] = system test[:command] |
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 ModuleName | |
extend ActiveSupport::Concern | |
module InstanceMethods | |
def destroy | |
run_callbacks :destroy do | |
if self.respond_to? :deleted | |
self.deleted = true | |
self.save(validate: false) | |
else | |
raise "deleted attribute not found in model" |
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 gist outlines a generic implementation of multistage deployment with Capistrano for Rails 3.1+. | |
# | |
# Usage: | |
# | |
# cap #{stage} deploy:setup | |
# cap #{stage} deploy:cold | |
# cap #{stage} deploy | |
# | |
# etc. |
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
wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-amd64.tar.bz2 | |
tar xvjf wkhtmltopdf-0.9.9-static-amd64.tar.bz2 | |
mv wkhtmltopdf-amd64 /usr/local/bin/wkhtmltopdf | |
chmod +x /usr/local/bin/wkhtmltopdf |
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
# lib/rack/revision.rb | |
module Rack | |
class Revision | |
@@revision = nil | |
File = ::File | |
def initialize(app, &block) | |
@app = app | |
@block = block | |
@file = File.join(Dir.pwd, 'REVISION') |
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
pg_dump -Fc | gzip -9 -c > dumpfile.gz |
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
#---------------------------------------------------------------------------- | |
# Ignore these files when commiting to a git repository | |
# | |
# The original version of this file is found here: | |
# https://github.com/RailsApps/rails3-application-templates/raw/master/files/gitignore.txt | |
# | |
# Corrections? Improvements? Create a GitHub issue: | |
# http://github.com/RailsApps/rails3-application-templates/issues | |
#---------------------------------------------------------------------------- |
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
#------------------------------------------------------------------------------ | |
# Returncode. | |
#------------------------------------------------------------------------------ | |
function returncode | |
{ | |
returncode=$? | |
if [ $returncode != 0 ]; then | |
echo "[$returncode]" | |
else | |
echo "" |
OlderNewer