Skip to content

Instantly share code, notes, and snippets.

View dpickett's full-sized avatar

Dan Pickett dpickett

View GitHub Profile
@dpickett
dpickett / migration.rb
Last active August 29, 2015 14:01
contrived migration
class UpdatePosts < ActiveRecord::Migration
class Post < ActiveRecord::Base
has_many :comments
end
class Comment < ActiveRecord::Base
belongs_to :post
end
def change
@dpickett
dpickett / player_pseudo.js
Last active August 29, 2015 14:03
players
function KeyHandler(){
//handy underscoreJS function
_.bindAll(this, 'handleUpKey', 'handleKey');
this.handleUp = function(e){
//we can use jQuery to trigger events on plain ol' JavaScript objects
$(this).trigger('up');
}
this.handleKey = function(e){
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Uncomment the following line to use case-sensitive completion.
irb(main):001:0> require 'rubygems'
=> false
irb(main):002:0> require 'hmac/sha1'
LoadError: no such file to load -- hmac/sha1
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
<html>
<head>
<title>Payment Sent</title>
</head>
<body>
<%= automated_line %>
<p>Hi <%= @contact_information.display_name %>,</p>
<html>
<head>
<title>Payment Sent</title>
</head>
<body>
<p>THIS IS AN AUTOMATED EMAIL</p>
<p>Hi ,</p>
require File.dirname(__FILE__) + '/../spec_helper'
class Message
has_many :copies
has_many :recipients, :through => :copies
end
class MessageCopy
belongs_to :recipient
belongs_to :message
rescue_from ActionController::UnknownAction, :with => :render_not_found_error
rescue_from ActionController::UnknownController, :with => :render_not_found_error
<%- tab_menu "User Menu" do |t| %>
<%= t.tab "Favorite Users", user_url(@user) %>
<%- end -%>
@message = Factory.build(:message)
@message.recipients << Factory(:user, :login => "recipients")
@message.save! #fail
user = Factory(:user)
@message = Factory(:message, :recipients => [User.find(:first)]) #great success