Skip to content

Instantly share code, notes, and snippets.

View dinjas's full-sized avatar
:shipit:
Alive

Jason Dinsmore dinjas

:shipit:
Alive
  • Battle Ground, WA
View GitHub Profile
@dhh
dhh / gist:1014971
Created June 8, 2011 18:09
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
@jasonrudolph
jasonrudolph / about.md
Last active May 2, 2025 12:20
Programming Achievements: How to Level Up as a Developer
@rstacruz
rstacruz / index.md
Last active April 28, 2025 21:24
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@peterhellberg
peterhellberg / Guardfile
Created January 12, 2012 15:08
External JSON API testing (using minitest/spec, rest-client and yajl-ruby)
guard 'shell' do
watch(/relation_tree_spec\.rb/) { `clear && ruby relation_tree_spec.rb` }
end
@sethbro
sethbro / spec_helper.rb
Created February 10, 2012 01:09
Rails unit, functional and integration tests in Minitest spec format.
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rubygems'
gem 'minitest'
require 'minitest/autorun'
require 'action_controller/test_case'
require 'miniskirt'
require 'capybara/rails'
@camertron
camertron / measure.rb
Created June 15, 2012 22:48
Measure the memory taken by a Ruby object (by Robert Klemme)
#!/bin/env ruby
# lazy hack from Robert Klemme
module Memory
# sizes are guessed, I was too lazy to look
# them up and then they are also platform
# dependent
REF_SIZE = 4 # ?
OBJ_OVERHEAD = 4 # ?

I highly suspect that the RSpec core team all use black backgrounds in their terminals because sometimes the colors aren’t so nice on my white terminal

I certainly use a black background. I'm not sure about the other RSpec core folks. Regardless, if there are some color changes we can make that would make output look good on a larger variety of backgrounds, we'll certainly consider that (do you have some suggested changes?). In the meantime, the colors are configurable, so you can change the colors to fit your preferences on your machine. First, create a file at

@tvand7093
tvand7093 / libplot-setup.md
Last active May 20, 2016 02:26
Setup Mac for libplot

Libplot setup on Mac

First, install XQuartz if you don't already have it.

Next, (assuming you have homebrew installed) run the following command: brew install plotutils --with-x11

This will install the required libraries.

Finally, add the following before your rules and commands in your makefile for building your application:

@dinjas
dinjas / README.md
Created March 28, 2016 02:15 — forked from sj26/README.md
Run MailCatcher in the background, always, on OS X

Place me.mailcatcher.plist into ~/Library/LaunchAgents, then run launchctl load ~/Library/LaunchAgents/me.mailcatcher.plist.

If you use pow, echo 1080 > ~/.pow/mailcatcher and go to http://mailcatcher.dev, otherwise use http://localhost:1080.

Currently pow doesn't seem to pass websockets through correctly. Looking into this.