Skip to content

Instantly share code, notes, and snippets.

Kenny Smith kjs3

Block or report user

Report or block kjs3

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:408311
require 'right_aws.rb'
@amz_public_key = 'myaccesskey' # S3 Public key
@amz_private_key = 'mysecretaccesskey' # S3 Private key
# You need to create a key/pair to do much of anything with aws. You can do this by going to
# http://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=access-key and clicking
# on the Key Pairs tab
@key_id = 'keyID' # Key ID from AWS (not the EC2 key/pairs)
@kjs3
kjs3 / event.rb
Created Apr 17, 2012
Event Model from a Rails project
View event.rb
require "iconv"
class Event < ActiveRecord::Base
belongs_to :event_category
has_many :line_items
has_many :region_links, :as => :region_linkable
has_many :regions, :through => :region_links
has_many :interest_links, :as => :interest_linkable
has_many :interests, :through => :interest_links
@kjs3
kjs3 / staging.rb
Created Apr 20, 2012
staging setup
View staging.rb
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
# Enabled for Heroku Cedar stack
config.serve_static_assets = true
config.static_cache_control = "public, max-age=691200" #set to 8 days
@kjs3
kjs3 / production.rb
Created Apr 25, 2012
asset stuff from production.rb
View production.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
# Enabled for Heroku Cedar stack
config.serve_static_assets = true
View heroku_logs.log
2012-04-25T16:04:31+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal/mime_responds.rb:246:in `respond_with'
2012-04-25T16:04:31+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:81:in `run_callbacks'
2012-04-25T16:04:31+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
2012-04-25T16:04:31+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/devise-2.0.4/app/controllers/devise/sessions_controller.rb:9:in `new'
2012-04-25T16:04:31+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/abstract_controller/callbacks.rb:17:in `process_action'
2012-04-25T16:04:31+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/abstract_controller/base.rb:167:in `process_action'
2012-04-25T16:04:31+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/abstract_controller/callbacks.rb:18:in `bloc
View inside_nginx
upstream unicorn {
server unix:/home/inside/sites/inside/shared/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name inside;
root /home/inside/sites/inside/current/public;
View redmine_nginx
upstream unicorn_projects {
server unix:/home/inside/sites/redmine/shared/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name redmine.inside;
root /home/inside/sites/redmine/current/public;
@kjs3
kjs3 / bb_multiple_render_problems.js.coffee
Created Oct 6, 2012
Backbone code that's rendering one of the models 4 extra times.
View bb_multiple_render_problems.js.coffee
# config file
window.App =
Models: {}
Collections: {}
Routers: {}
Views: {}
init: ->
@service_providers = new App.Collections.ServiceProvidersCollection()
@service_providers.fetch
@kjs3
kjs3 / gist:6401062
Created Aug 31, 2013
fork is making irb unresponsive
View gist:6401062
# This makes irb sluggish and randomly unresponsive
if fork
puts "Hello from parent process #{Process.pid}"
else
puts "Hello from child process #{Process.pid}"
# I thought the child process would exit automatically here?
end
You can’t perform that action at this time.