Skip to content

Instantly share code, notes, and snippets.

View Will-Sommers's full-sized avatar

Will Sommers Will-Sommers

View GitHub Profile
@Will-Sommers
Will-Sommers / sampleapp
Created February 28, 2012 01:05
SampleApp
First refresh I get this:
Gem::LoadError in UsersController#show
bcrypt-ruby is not part of the bundle. Add it to Gemfile.
Second refresh I get this:
NoMethodError in UsersController#show
undefined method `key?' for nil:NilClass
@Will-Sommers
Will-Sommers / SampleAppGemFile
Created February 28, 2012 17:12
SampleAppG
* actionmailer (3.2.1)
* actionpack (3.2.1)
* activemodel (3.2.1)
* activerecord (3.2.1)
* activeresource (3.2.1)
* activesupport (3.2.1)
* annotate (2.4.1.beta1)
* arel (3.0.2)
* bcrypt-ruby (3.0.1)
* builder (3.0.0)
@Will-Sommers
Will-Sommers / signinerror
Created March 5, 2012 15:39
Signin Error
routes.db
Second::Application.routes.draw do
resources :users
resources :sessions, only: [:new, :create, :destroy]
match '/signup', to: 'users#new'
match '/signin', to: 'sessions#new'
match '/signout', to: 'sessions#destroy', via: :delete
match '/help', to: 'static_pages#help'
@Will-Sommers
Will-Sommers / error
Created March 5, 2012 17:04
Rspec remember_token
$ rails console
Loading development environment (Rails 3.2.1)
1.9.3-p0 :001 > User.first.remember_token
User Load (0.6ms) SELECT "users".* FROM "users" LIMIT 1
NoMethodError: undefined method `remember_token' for #<User:0x007fec96cf9830>
from /Users/Will/.rvm/gems/ruby-1.9.3-p0@rails313/gems/activemodel-3.2.1/lib/active_model/attribute_methods.rb:407:in `method_missing'
from /Users/Will/.rvm/gems/ruby-1.9.3-p0@rails313/gems/activerecord-3.2.1/lib/active_record/attribute_methods.rb:126:in `method_missing'
from (irb):1
from /Users/Will/.rvm/gems/ruby-1.9.3-p0@rails313/gems/railties-3.2.1/lib/rails/commands/console.rb:47:in `start'
from /Users/Will/.rvm/gems/ruby-1.9.3-p0@rails313/gems/railties-3.2.1/lib/rails/commands/console.rb:8:in `start'
@Will-Sommers
Will-Sommers / Rspec errors
Created March 5, 2012 21:01
Rails Tutorial
Failures:
1) UsersController GET 'name:string' returns http success
Failure/Error: get 'name:string'
AbstractController::ActionNotFound:
The action 'name:string' could not be found for UsersController
# ./spec/controllers/users_controller_spec.rb:6:in `block (3 levels) in <top (required)>'
2) UsersController GET 'email:string' returns http success
Failure/Error: get 'email:string'
def gen_sql
relation = Set
@recipient ||= "company"
@date_window ||= "1year"
case @date_window
when "1day"
$('#transaction_recipient').on 'change', ->
switch $(this).val()
when 'artist' then hide_and_slide('artist')
when 'venue' then hide_and_slide('venue')
when 'affiliate' then hide_and_slide('affiliate')
@Will-Sommers
Will-Sommers / adv_js_class_1
Created September 28, 2013 16:49
countdown
function countdown(seconds) {
console.log(seconds);
window.setTimeout(function(){
if (seconds !== 0) {
countdown(seconds - 1);
}
}, 1000);
}
@Will-Sommers
Will-Sommers / gist:7968882
Created December 15, 2013 04:29
CracklePop for HaSch.
(1..100).each do |x|
if x%15 == 0
puts "CracklePop"
elsif x%3 == 0
puts "Crackle"
elsif x%5 == 0;
puts "Pop"
else
puts x
end

Server response

(defn generate-response [data & [status]]
  {:status (or status 200)
   :headers {"Content-Type" "application/edn"}
   :body (pr-str {:1 "hi"})})