Skip to content

Instantly share code, notes, and snippets.

@blvrd
blvrd / gist:5646556
Created May 24, 2013 21:14
Vote error from console
Started POST "/posts/1/vote?vote=true" for 127.0.0.1 at 2013-05-24 17:12:44 -0400
Connecting to database specified by database.yml
AbstractController::ActionNotFound (The action 'vote' could not be found for PostsController):
actionpack (3.2.12) lib/abstract_controller/base.rb:116:in `process'
actionpack (3.2.12) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.12) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.12) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.12) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.12) lib/action_dispatch/routing/route_set.rb:73:in `call'
@blvrd
blvrd / gist:5674562
Created May 29, 2013 23:11
error for bundle install
Garretts-MacBook-Pro:myflix-jun-2013 Garrett$ rails generate migration create_videos
Could not find pg-0.14.1 in any of the sources
Run `bundle install` to install missing gems.
Garretts-MacBook-Pro:myflix-jun-2013 Garrett$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Using rake (10.0.3)
Using i18n (0.6.1)
Using multi_json (1.5.0)
Using activesupport (3.2.11)
Garretts-MacBook-Pro:myflix-jun-2013 Garrett$ rspec
Rack::File headers parameter replaces cache_control after Rack 1.5.
F..........................FFFF.......
Failures:
1) Video
Failure/Error: it { should have_many(:reviews).order('created_at DESC')}
Expected Video to have a has_many association called reviews (reviews should be ordered by created_at DESC)
# ./spec/models/video_spec.rb:7:in `block (2 levels) in <top (required)>'
@blvrd
blvrd / gist:5912771
Created July 2, 2013 20:22
Strange error
Garretts-MacBook-Pro:myflix-jun-2013 Garrett$ heroku run rake db:seed
Running `rake db:seed` attached to terminal... up, run.4169
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
Connecting to database specified by DATABASE_URL
@blvrd
blvrd / gist:6062918
Created July 23, 2013 14:48
heroku logs
2013-07-23T14:46:39.352679+00:00 app[web.1]: [2013-07-23 14:46:39] INFO WEBrick::HTTPServer#start: pid=2 port=26208
2013-07-23T14:46:39.352282+00:00 app[web.1]: [2013-07-23 14:46:39] INFO WEBrick 1.3.1
2013-07-23T14:46:39.352282+00:00 app[web.1]: [2013-07-23 14:46:39] INFO ruby 2.0.0 (2013-06-27) [x86_64-linux]
2013-07-23T14:46:39.699842+00:00 heroku[web.1]: State changed from starting to up
2013-07-23T14:46:42.265235+00:00 app[web.1]: Started GET "/" for 207.97.155.2 at 2013-07-23 14:46:42 +0000
2013-07-23T14:46:42.377014+00:00 app[web.1]: Rendered shared/_header.html.haml (7.0ms)
2013-07-23T14:46:42.387734+00:00 heroku[router]: at=info method=GET path=/ host=garrett-myflix.herokuapp.com fwd="207.97.155.2" dyno=web.1 connect=3ms service=153ms status=200 bytes=1023
2013-07-23T14:46:42.377014+00:00 app[web.1]: Processing by StaticController#front as HTML
2013-07-23T14:46:42.377014+00:00 app[web.1]: Rendered static/front.html.haml within layouts/application (3.3ms)
2013-07-23T14:46:42.377014+00:00 app[we
@blvrd
blvrd / gist:8968751
Created February 13, 2014 02:36
lisp
def lisp_eval(function)
if function[0] == "#"
return true if function[1] == "t"
elsif function[0] == "("
if function.split('')[1..-2].all?{|letter| letter != ")"}
operation_eval(function)
else
operation_eval function.split(")").to_s.delete("\"").split("(").last.delete(']')
end
elsif function[0].to_i
$(function(){
$(document).foundation();
// Hides every element except the first one
$("fieldset.person").slice(1).addClass("hidden")
// Used the "on click" to handle event bubbling
$(".row").on("click", ".add-person", function() {
// Finds the last fieldset that is visible and makes the next hidden one visible
$("fieldset.person").not(".hidden").last().next("fieldset.person").removeClass("hidden")
@blvrd
blvrd / gist:75eb064e2b4b7eda493a
Created May 9, 2014 00:00
Generate default avatars
#### Model
def initials
[Person.first_letter(first_name), Person.first_letter(last_name)].compact.join("")
end
# "try" is a method Ryan showed me. It sends whatever method you specify
# and if it doesn't work, it returns nil instead of an error.
def self.first_letter(string)
string.try(:split, "").try(:first)
@blvrd
blvrd / game.js
Created August 1, 2016 04:34
Game of Life starting point
var gameOfLife = {
width: 12,
height: 12,
createAndShowBoard: function () {
// create <table> element
var goltable = document.createElement("tbody");
// build Table HTML
var tablehtml = '';
@blvrd
blvrd / game.js
Created August 1, 2016 14:51
Game of Life
var gameOfLife = {
width: 12,
height: 12,
stepInterval: 100,
playing: false,
intervalObject: null,
createAndShowBoard: function(state) {
// create <table> element
var goltable = document.createElement("tbody");