Skip to content

Instantly share code, notes, and snippets.

View keppy's full-sized avatar
🥧
Pie is delicious

James Dominguez keppy

🥧
Pie is delicious
View GitHub Profile
@keppy
keppy / gist:5665114
Created May 28, 2013 18:47
Channel Page Template
---
pageMetadata:
pageTitle:
header:
breadcrumbs:
title:
slats:
# Rotator
-
moduleType: rotator-slat
@keppy
keppy / application_controller.rb
Created September 27, 2012 06:51
required parameter missing: user
class ApplicationController < ActionController::Base
protect_from_forgery
## filter_parameter_logging :password, :password_confirmation
helper_method :current_user_session, :current_user, :permitted_params
...
def permitted_params
@permitted_params || PermittedParams.new(params, current_user)
end
end
@keppy
keppy / _client_reservations.html.erb
Created September 3, 2012 20:14
Ajax call not displaying dynamic content--@invoice_reservations--the partial is rendered though.
<table class="table table-bordered table-striped">
<%= @invoice_reservations.each do |r| %>
<tr>
<td><%= r.name %></td>
</tr>
</table>
@keppy
keppy / application trace
Created September 1, 2012 19:34
TypeError in InvoicesController#show_client_invoices
app/controllers/invoices_controller.rb:3:in `[]'
app/controllers/invoices_controller.rb:3:in `show_client_invoices'
@keppy
keppy / employee_test.rb
Created August 31, 2012 02:29
First tests
require "minitest_helper"
class EmployeeTest < MiniTest::Unit::TestCase
def setup
super
@employee = Employee.new(first_name: "Jannis", last_name: "Steele")
@user = User.new(login: "Geoblaster", password: "foobar", password_confirmation: "foobar", email: "hero@mcpooch.com")
@employee.user = @user
end
@keppy
keppy / gist:3133180
Created July 18, 2012 00:29
Problem with routes
routes.rb
----------
Debateable::Application.routes.draw do
resources :users do
resources :posts
end
resources :topics do
resources :posts
@keppy
keppy / gist:3042484
Created July 3, 2012 19:50
Method help
require 'spec_helper'
describe Debate do
#let(:prop_user) { FactoryGirl.create(:user) }
#let(:opp_user) { FactoryGirl.create(:user) }
before do
@prop_user = User.new(name: "Prop User", email: "prop@email.com")
@opp_user = User.new(name: "Opp User", email: "opp@email.com")
@debate = Debate.new(title: "Test Debate")
@keppy
keppy / gist:3012287
Created June 28, 2012 16:25
Modeling a debate app
def User
has_many :propositions, :as => :debateable
has_many :oppositions, :as => :debateable
end
def Proposition
belongs_to :debateable, :polymorphic => :true
has_one :opposition, :as => :debateable
end
class PokerGame
include Enumerable
include Comparable
attr_reader :hand
def initialize(hands, cards)
ranks = %w{ 2 3 4 5 6 7 8 9 T J Q K A }
suits = %w{ S H D C }
card_stack = Array.new
num_hands = Array.new
class PokerGame
include Enumerable
include Comparable
attr_reader :hand
def initialize(hands, cards)
ranks = %w{ 2 3 4 5 6 7 8 9 T J Q K A }
suits = %w{ S H D C }
card_stack = Array.new
h = Array.new