Skip to content

Instantly share code, notes, and snippets.

View itskingori's full-sized avatar
🚢
Shipping

King'ori Maina itskingori

🚢
Shipping
View GitHub Profile
@itskingori
itskingori / .irbrc
Created February 19, 2016 14:13 — forked from pjb3/.irbrc
Basic Ruby IRB config
require 'irb/completion'
# History
#require 'irb/ext/save-history' #wirble does history
IRB.conf[:PROMPT_MODE] = :SIMPLE
IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
IRB.conf[:AUTO_INDENT] = true
# use HIRB if available
@itskingori
itskingori / application_controller.rb
Last active March 4, 2024 09:07 — forked from speed-of-light/application_controller.rb
How to handle exceptions like 401, 501, 404 in Rails
# As used with CanCan and Devise
class ApplicationController < ActionController::Base
protect_from_forgery
include ErrorResponseActions
rescue_from CanCan::AccessDenied, :with => :authorization_error
rescue_from ActiveRecord::RecordNotFound, :with => :resource_not_found
before_filter :authenticate!
# As used with CanCan and Devise
class ApplicationController < ActionController::Base
protect_from_forgery
include ErrorResponseActions
rescue_from CanCan::AccessDenied, :with => :authorization_error
rescue_from ActiveRecord::RecordNotFound, :with => :resource_not_found
before_filter :authenticate!
@itskingori
itskingori / elastic-beanstalk-delayed-jobs.md
Last active August 13, 2016 21:13 — forked from bhauman/delayed_job_eb_sysvinit
Attempt at creating a 'delayed_jobs' service on AWS EB

Delayed Jobs Service

# chkconfig: 2345 99 20
# description: Starts, restarts or stops delayed job processor
# servicename: delayed_jobs

This says that the random script should be started in levels 2, 3, 4, and 5, that its start priority should be 99, and that its stop priority should be 20.