This file contains hidden or 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
class ApplicationController | |
after_filter :set_access_control_headers | |
def set_access_control_headers | |
# Any domain | |
# headers['Access-Control-Allow-Origin'] = '*' | |
# Specific domain |
This file contains hidden or 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/environments/production.rb | |
# We're on Heroku, just output straight to STDOUT | |
# This is required because we're using Unicorn, too: https://github.com/ryanb/cancan/issues/511#issuecomment-3643266 | |
config.logger = Logger.new(STDOUT) | |
config.logger.level = Logger.const_get(ENV['LOG_LEVEL'] ? ENV['LOG_LEVEL'].upcase : 'INFO') |
This file contains hidden or 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
$ cat config/initializers/new_relic_reconnect.rb | |
# Ensure the agent is started using Unicorn | |
# This is needed when using Unicorn and preload_app is not set to true. | |
# See http://support.newrelic.com/kb/troubleshooting/unicorn-no-data | |
NewRelic::Agent.after_fork(:force_reconnect => true) if defined? Unicorn |
This file contains hidden or 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
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb |
This file contains hidden or 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
class ThingsController < ApplicationController | |
before_filter :get_thing!, :only => [:show] | |
before_filter :friends_only!, :only => [:show] | |
def show | |
render @thing | |
end |
This file contains hidden or 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
json = ActiveSupport::JSON.decode(google)['predictions'] | |
# sort of traditional for() loop style | |
results = [] | |
json.each do |location| | |
results << { | |
:short => 'foo', | |
:long => 'bar' | |
} | |
end |
This file contains hidden or 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
$ cat deploy | |
#!/bin/sh | |
# any extra arguments are passed to `git push`, e.g. -f | |
app='vhx-artists' | |
remote='heroku' | |
git push $remote master $1 || exit $? | |
heroku run rake assets:precompile --app=$app || exit $? |
This file contains hidden or 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/environments/production.rb | |
# We're on Heroku, just output straight to STDOUT | |
# This is required because we're using Unicorn: https://github.com/ryanb/cancan/issues/511#issuecomment-3643266 | |
config.logger = Logger.new(STDOUT) | |
config.logger.level = Logger.const_get(ENV['LOG_LEVEL'] ? ENV['LOG_LEVEL'].upcase : 'INFO') |
This file contains hidden or 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
<meta property="og:type" content="vhxtv_ns:video" /> | |
<meta property="og:title" content="Brimley's Breath" /> | |
<meta property="og:image" content="http://b.vimeocdn.com/ts/617/924/61792473_200.jpg" /> | |
<meta property="og:description" content="From inaugural Tricorn" /> | |
<meta property="og:url" content="http://vhx.tv/1234" /> | |
<meta property="og:video" content="http://www.vimeo.com/moogaloop.swf?clip_id=3102336" /> | |
<meta property="og:video:url" content="http://vimeo.com/3102336" /> | |
<meta property="og:video:type" content="application/x-shockwave-flash" /> | |
<meta property="og:video:width" content="560" /> | |
<meta property="og:video:height" content="315" /> |
This file contains hidden or 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
:tddium: | |
:environment: | |
'RAILS_ENV': 'test' | |