Skip to content

Instantly share code, notes, and snippets.

View danguita's full-sized avatar

David Anguita danguita

View GitHub Profile
@danguita
danguita / gist:4984484
Created February 19, 2013 09:48
Enable HSTORE extension by default on PG databases
psql -d template1 -c 'create extension hstore;'
@danguita
danguita / gist:4696819
Created February 2, 2013 10:17
Fix Nokogiri + LibXML dylib issues
# WARNING: Nokogiri was built against LibXML version A, but has dynamically loaded B
brew uninstall libxml2
gem uninstall nokogiri
gem install nokogiri
brew install libxml2

Zero downtime deploys with unicorn + nginx + runit + rvm + chef

Below are the actual files we use in one of our latest production applications at Agora Games to achieve zero downtime deploys with unicorn. You've probably already read the GitHub blog post on Unicorn and would like to try zero downtime deploys for your application. I hope these files and notes help. I am happy to update these files or these notes if there are comments/questions. YMMV (of course).

Other application notes:

  • Our application uses MongoDB, so we don't have database migrations to worry about as with MySQL or postgresql. That does not mean that we won't have to worry about issues with the database with indexes being built in MongoDB or what have you.
  • We use capistrano for deployment.

Salient points for each file:

###
// ==UserScript==
// @name Gmail Monospace
// @namespace http://owns.ch
// @description Make emails and textareas in Gmail monospace
// @author Alen Mujezinovic & David Anguita
// @homepage http://gist.github.com/4536975
// @match http://mail.google.com/*
// @match https://mail.google.com/*
// ==/UserScript==
_ _ _
____ | | (_) |
/ __ \ __| | __ _ _ __ __ _ _ _ _| |_ __ _
/ / _` |/ _` |/ _` | '_ \ / _` | | | | | __/ _` |
| | (_| | (_| | (_| | | | | (_| | |_| | | |_ (_| |
\ \__,_|\__,_|\__,_|_| |_|\__, |\__,_|_|\__\__,_|
\____/ __/ |
|___/
@danguita
danguita / deploy.rake
Last active December 10, 2015 13:58 — forked from ndbroadbent/deploy.rake
require 'fileutils'
# Warning: The following deploy task will completely overwrite whatever is currently deployed to Heroku.
# The deploy branch is rebased onto master, so the push needs to be forced.
desc "Deploy app to Heroku after precompiling assets"
task :deploy do
deploy_branch = 'heroku'
remote = 'heroku'
deploy_repo_dir = "tmp/heroku_deploy"
@danguita
danguita / environment.rb
Created December 7, 2012 16:45
Paperclip defaults for Amazon S3 domain-style buckets
config.paperclip_defaults = {
:storage => :s3,
:url => ":s3_domain_url",
:path => ":class/:id.:style.:extension",
:s3_credentials => {
:bucket => ENV['AWS_BUCKET'],
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
}
@danguita
danguita / tts-usage.rb
Created November 13, 2012 13:28
Text to speech through tts-api.com
#!/usr/bin/env ruby
require_relative 'tts'
class String
include TTS::String
end
"fuck yeah".to_speech
@danguita
danguita / gist:4003468
Created November 2, 2012 18:43
format a JSON string
{...} | python -mjson.tool
@danguita
danguita / gist:3910953
Created October 18, 2012 10:47
tmux 1.7 changelog
CHANGES FROM 1.6 to 1.7, 13 October 2012
* tmux configuration files now support line-continuation with a "\" at the
end of a line.
* New option status-position to move the status line to the top or bottom of
the screen.
* Enforce history-limit option when clearing the screen.
* Give each window a unique id, like panes but prefixed with @.
* Add pane id to each pane in layout description (while still accepting
the old form).