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
set :rails_env, :production | |
set :unicorn_binary, "/usr/bin/unicorn" | |
set :unicorn_config, "#{current_path}/config/unicorn.rb" | |
set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid" | |
namespace :deploy do | |
task :start, :roles => :app, :except => { :no_release => true } do | |
run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D" | |
end | |
task :stop, :roles => :app, :except => { :no_release => true } do |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>SoundCloud OAuth 2 User Agent Authentication Flow Demo</title> | |
<script type="text/javascript" charset="utf-8" src="javascript/jquery-1.4.2.js"></script> | |
<script type="text/javascript" charset="utf-8"> | |
$(function () { | |
var extractToken = function(hash) { |
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
# Heavily borrowed from ActiveMerchant::Biling::CreditCard | |
# Updated for ActiveModel::Validations | |
class CreditCard | |
include ActiveMerchant::Billing::CreditCardMethods | |
include ActiveModel::Validations | |
include ActiveModel::Validations::Callbacks | |
include ActiveModel::Naming | |
## Attributes |
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 bash | |
# Configuration | |
SERVER='myserver' | |
DEPLOY_TO='/path/to/app' | |
EXCLUDE='*.swp .git/ db/sphinx/ tmp/ log/' | |
DRY_RUN=false | |
DEPLOY_GEM_PATH='/opt/ec/ruby/1.8.7/lib/ruby/gems/1.8' |
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
# Bulk API design | |
# | |
# resources :posts | |
class PostsController < ActiveController::Base | |
# GET /posts/1,4,50,90 | |
# post_url([ @post, @post ]) | |
def show_many | |
@posts = Post.find(params[:ids]) | |
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
# in rails application.rb | |
initializer "postgresql.no_default_string_limit" do | |
ActiveSupport.on_load(:active_record) do | |
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:string].delete(:limit) | |
end | |
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
# for more info: https://gist.github.com/1120938 |
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 node | |
// this file is stored in a directory of APP_ROOT/script for me, all things are relative to that | |
var APP_ROOT = __dirname+"/../"; | |
// this assumes there is a file stored in APP_ROOT called "config.js" with the following structure: | |
// | |
// module.exports = { | |
// "development: { | |
// "postgresql": "tcp://postgres@localhost/dev-db" |
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
# ./config/initializers/asset_precompile_prefix_fix.rb | |
# | |
# So we can deploy at a SubURI, and precompile assets to respect that with: | |
# RAILS_RELATIVE_URL_ROOT=/foo rake assets:precompile | |
# | |
# See: http://stackoverflow.com/questions/7293918/broken-precompiled-assets-in-rails-3-1-when-deploying-to-a-sub-uri | |
# | |
# Confirmed working in Rails 3.1.3 | |
# Future versions of Rails may make this monkey patch unneccesary. (or break | |
# it without making it unneccesary) |
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 snippet has been updated, but not tested in practice. It should work, please check / leave comments in case it doesn't. !! ## | |
# originally from https://groups.google.com/a/webmproject.org/group/webp-discuss/browse_thread/thread/196ac4ea705688d8 | |
<IfModule mod_rewrite.c> | |
# TODO: don't forget to put | |
# AddType image/webp .webp | |
# in your mods-available/mime.conf | |
# (though this is optional because we're setting | |
# the mime type manually in the RewriteRule) |
OlderNewer