Skip to content

Instantly share code, notes, and snippets.


Nate Hopkins hopsoft

View GitHub Profile
hopsoft / gist:9216801
Created Feb 25, 2014
Install Docker with devicemapper driver
View gist:9216801
echo deb docker main > /etc/apt/sources.list.d/docker.list
apt-key adv --keyserver --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
apt-get -y --force-yes update
apt-get -y --force-yes install lxc-docker
echo "DOCKER_OPTS=\"-s=devicemapper\"" > /etc/default/docker
service docker restart
hopsoft / transition.rb
Last active Aug 29, 2015
Han Transition Wrapper in Ruby
View transition.rb
require "active_support/all"
require "forwardable"
class Transition
extend Forwardable
def_delegators :params, :to_query, :to_json
def initialize(han_transition)
@han_transition = han_transition.symbolize_keys
@params = han_transition[:params].symbolize_keys
View gist:7a2afcb46ce14b5441ff
# Models
# app/models/user.rb
class User < ActiveRecord::Base
has_many :articles
has_many :videos
has_many :photos
# app/models/article.rb
hopsoft / gist:2452e372572a15f4b1ad
Created Jan 15, 2015
Easy way to create a Rails fixture stub
View gist:2452e372572a15f4b1ad
require "model_probe"
User.extend ModelProbe
hopsoft / some_controller_test.rb
Last active Aug 29, 2015
Fix routing for engine controller tests in Rails
View some_controller_test.rb
require 'test_helper'
module ExampleEngine
class SomeControllerTest < ActionController::TestCase
setup do
@routes = ExampleEngine::Engine.routes
test "index response" do
hopsoft / example_component.js
Last active Aug 29, 2015
React Component Structure
View example_component.js
(function (app) {
var components = (app.components || (app.components = {}));
app.components.ExampleComponent = React.createClass(
mixins: [],
propTypes: {...},
getInitialState: function () {
return {
hopsoft / lodash.js
Created Jul 18, 2015
Lodash Manifest File
View lodash.js
// vendor/assets/javascripts/modules/lodash.js
//= require lodash
hopsoft / application_helper.rb
Last active Aug 29, 2015
JavaScript Modules Tag Helper
View application_helper.rb
# app/helpers/application_helper.rb
module ApplicationHelper
def javascript_modules_tag
paths = Dir[
hopsoft / example.js
Created Jul 18, 2015
Example Module
View example.js
// app/assets/javascripts/modules/example.js
define([modules.lodash], function (_) {
return "This is an example.";
You can’t perform that action at this time.