Skip to content

Instantly share code, notes, and snippets.

View gmcintire's full-sized avatar
:shipit:

Graham McIntire gmcintire

:shipit:
View GitHub Profile
@gmcintire
gmcintire / auto_save_and_open_page.rb
Created April 21, 2012 14:10 — forked from hoverlover/auto_save_and_open_page.rb
Auto save_and_open_page on failure for Capybara
module Capybara
def Capybara.auto_save_and_open_page=(val)
@auto_save_and_open_page = !!val
end
def Capybara.auto_save_and_open_page?
@auto_save_and_open_page ||= false
end
end
@gmcintire
gmcintire / config.rb
Created March 8, 2012 01:44
capistrano setting
:copy_exclude => ['.git']
@gmcintire
gmcintire / Guardfile
Created February 16, 2012 20:50
Guardfile
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard 'bundler' do
watch('Gemfile')
# Uncomment next line if Gemfile contain `gemspec' command
# watch(/^.+\.gemspec/)
end
guard 'rails' do
@gmcintire
gmcintire / osm.pbf to postgis
Created January 13, 2012 03:16 — forked from springmeyer/osm.pbf to postgis
import a pbf file into postgis from geofabrik using osmosis and osm2pgsql
# note: there is work afoot to load pbf directly with osm2pgsql
# http://lists.openstreetmap.org/pipermail/dev/2010-October/020953.html
# but for now osmosis >= 0.37 works best
# install java/osmosis if you don't already have it
sudo apt-get install sun-java6-jre
wget http://bretth.dev.openstreetmap.org/osmosis-build/osmosis-0.37.zip
unzip osmosis-0.37.zip
cd osmosis-0.37
chmod +x bin/osmosis
@gmcintire
gmcintire / etc_init.d_unicorn_example.co.uk
Created January 5, 2012 01:51 — forked from jumski/etc_init.d_unicorn_example.co.uk
Ruby on Rails server setup on Ubuntu 11.04 with Nginx, Unicorn, Rbenv
#! /bin/bash
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the unicorn web server
# Description: starts unicorn
@gmcintire
gmcintire / installation.sh
Created January 5, 2012 00:24 — forked from mikhailov/installation.sh
Nginx+passenger application config: ssl redirection, http headers, passenger optimal settings. see details: http://mikhailov.posterous.com/nginx
$ cd /usr/src
$ wget http://nginx.org/download/nginx-0.8.52.tar.gz
$ tar xzvf ./nginx-0.8.52.tar.gz
$ rm ./nginx-0.8.52.tar.gz
$ gem install s3sync capistrano capistrano-ext passenger --no-ri --no-rdoc
$ passenger-install-nginx-module
# Automatically download and install Nginx? 2. No: I want to customize my Nginx installation
# Where is your Nginx source code located?: /usr/src/nginx-0.8.52
# Where do you want to install Nginx to?: /opt/nginx
@gmcintire
gmcintire / deploy.rb
Created January 5, 2012 00:12 — forked from zires/deploy.rb
deploy use unicorn and nginx
set :application, "hermes"
set :repository, "git@your_repository:hermes.git"
set :user, 'root'
set :use_sudo, false
set :deploy_via, :remote_cache
set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
role :web, "xxx.com" # Your HTTP server, Apache/etc
def output name=((default=true); "caius")
puts "name: #{name.inspect}"
puts "default: #{default.inspect}"
end
output
# >> name: "caius"
# >> default: true
output "avdi"
@gmcintire
gmcintire / deploy.rb
Created December 16, 2011 02:21 — forked from stympy/deploy.rb
Skip asset pre-compilation when deploying if the assets didn't change
namespace :deploy do
namespace :assets do
task :precompile, :roles => :web, :except => { :no_release => true } do
from = source.next_revision(current_revision)
if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
else
logger.info "Skipping asset pre-compilation because there were no asset changes"
end
end
@gmcintire
gmcintire / gist:1331628
Created November 1, 2011 19:25
country call prefixes
Each line is composed of 4 different tokens: prefixes, name of country entity, continent, country numeric code.
1A|Sov. Mil. Order of Malta|EU|246
3A|Monaco|EU|260
3B6,3B7|Agalega & St. Brandon Is.|AF|4
3B8|Mauritius|AF|165
3B9|Rodriguez I.|AF|207
3C|Equatorial Guinea|AF|49
3C0|Annobon I.|AF|195
3D2|Fiji|OC|176