Skip to content

Instantly share code, notes, and snippets.

View dobs's full-sized avatar
💭
🍕

Daniel O'Brien dobs

💭
🍕
View GitHub Profile

Keybase proof

I hereby claim:

To claim this, I am signing this object:

module UniquelyIdentified
extend ActiveSupport::Concern
included do
before_create :assign_unique_id
end
protected
def assign_unique_id
@dobs
dobs / rails_template.rb
Last active August 29, 2015 14:00
dobs' Rails Template
# This Rails template aims to bootstrap features that are standard across most
# of my personal projects.
#
# TODO: Better initialization.
# TODO: More thorough configuration.
# TODO: More intelligent gem grouping, especially with respect to assets.
require 'open-uri'
add_source 'https://rubygems.org'
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
RangeInput
StringInput
TextInput
@dobs
dobs / unicorn.rb
Last active December 29, 2015 08:29
Example Unicorn config
rails_env = ENV['RAILS_ENV'] || 'production'
rails_root = `pwd`.gsub("\n", "")
rails_user = ENV['RAILS_USER'] || 'rails'
rails_group = ENV['RAILS_GROUP'] || 'group'
unless rails_env == 'production'
listen '127.0.0.1:8080'
else
listen "#{rails_root}/tmp/sockets/unicorn.sock", backlog: 64
end
@dobs
dobs / deploy.rb
Last active December 29, 2015 02:39
Unicorn + Capistrano 3 + RVM + GIT
set :application, '<%= application %>'
set :repo_url, '<%= repo_url %>'
set :user, '<%= user %>'
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }
set :deploy_to, "<%= deploy_to %>"
set :scm, :git
set :format, :pretty
@dobs
dobs / gist:6101369
Created July 28, 2013 23:59
Simple cookie and modhash generation script.
# Simple cookie and modhash generation script.
#
# Takes a username and password on the command line and generates a
# corresponding long-lived password.
require 'io/console'
require 'multi_json'
require 'net/http'
printf 'Username: '