Skip to content

Instantly share code, notes, and snippets.

Jason Lewis canweriotnow

Block or report user

Report or block canweriotnow

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
# This script will setup Evm (Emacs Version Manager) and Cask on
# Travis to use for Emacs Lisp testing.
# In .travis.yml, add this:
# - curl -fsSkL > && source ./
# Emacs 24.3 is installed in the above script because Cask requires
canweriotnow /
Last active Aug 13, 2019 — forked from havenwood/
On Debian, Ubuntu, or Mint: install Ruby 2.3.1 with chruby and ruby-build, ruby-install, and gem_home
# Install apt-get packages:
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
# Install chruby:
tar -xzvf chruby-0.3.9.tar.gz
cd chruby-0.2.3
sudo make install
App = new Marionette.Application();
App.addRegions {
"headerRegion": "#header"
"topMenuRegion": "#top-menu"
"mainRegion" : "#main"
App.on 'initialize:after', ->
View XXXXXXXXXXXXX_add_authentication_token_to_users.rb
# db/migrate/XXXXXXXXXXXXX_add_authentication_token_to_users.rb
class AddAuthenticationTokenToUsers < ActiveRecord::Migration
def change
add_column :users, :authentication_token, :string
add_index :users, :authentication_token, :unique => true
View description.markdown

Polymorphic Associations reversed

It's pretty easy to do polymorphic associations in Rails: A Picture can belong to either a BlogPost or an Article. But what if you need the relationship the other way around? A Picture, a Text and a Video can belong to an Article, and that article can find all media by calling

This example shows how to create an ArticleElement join model that handles the polymorphic relationship. To add fields that are common to all polymorphic models, add fields to the join model.

canweriotnow / gist:2492535
Created Apr 25, 2012 — forked from thommahoney/gist:2491946
RailsConf 2012 Lightning Talks
View gist:2492535
5 min:
~Objective-C + Rails:
Communicating w/rails from iOS/mac OS
Dan Hassin
1 min:
~Painless Javascript
koting hatduklgg
with wind tunnel
canweriotnow / unicorn
Created Jul 5, 2011
/etc/init.d script for unicorn
View unicorn
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
# Modified by
# based on by
## A sample /etc/unicorn/my_app.conf
You can’t perform that action at this time.