Skip to content

Instantly share code, notes, and snippets.

rake routes
Prefix Verb URI Pattern Controller#Action
decks_sim GET /decks/sim(.:format) decks#sim
decks GET /decks(.:format) decks#index
POST /decks(.:format) decks#create
new_deck GET /decks/new(.:format) decks#new
edit_deck GET /decks/:id/edit(.:format) decks#edit
deck GET /decks/:id(.:format) decks#show
PATCH /decks/:id(.:format) decks#update
PUT /decks/:id(.:format) decks#update
Started PATCH "/decks/8" for ::1 at 2015-02-14 11:47:19 +0000
Processing by DecksController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"Xspb+SDnJoX1v+oOVHn7s42b2m34qtRajUJkwCPKgDxXkGT8wMepySokziI8Rqpceh0YuegNvBQfInc2RtCzYA==", "deck"=>{"name"=>"HH", "cards"=>"Headless Horseman,Headless Horseman,Headless Horseman,Headless Horseman,Headless Horseman,Headless Horseman,Headless Horseman,Headless Horseman,Headless Horseman,Headless Horseman", "runes"=>"Nimble Soul, Arctic Freeze,Leaf,Tsunami", "demon_name"=>"SeaKing"}, "commit"=>"Update Deck", "id"=>"8"}
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]]
Deck Load (0.3ms) SELECT "decks".* FROM "decks" WHERE "decks"."id" = ? LIMIT 1 [["id", 8]]
Unpermitted parameter: demon_name
(0.1ms) begin transaction
(0.1ms) commit transaction
Redirected to http://localhost:3000/decks/8
Completed 302 Found in 122ms (ActiveRecord: 0.9ms)
@JamesZoft
JamesZoft / sokoban.rb
Created March 28, 2012 14:32
Sokoban
#!/usr/bin/ruby
require 'pp'
$rows
$cols
class Sokoban
attr_accessor :crates, :empty_storage, :filled_storage, :playing_grid, :crate_id, :man_id, :wall_id, :floor_id,
:storage_id, :crate_on_storage_id, :man_on_storage_id, :symbols, :workman, :move_coords
@JamesZoft
JamesZoft / sokoban_extract.rb
Created March 28, 2012 14:40
sokoban_extract
def play
puts "Welcome to Sokoban! The aim of the game is to put all of the crates, which are the \'" + @crate_id + "\' symbols onto the storage pallets, which are the \'" + @storage_id + "\' symbols! A list of all the symbols is available if you type \"help\", and the status of the game is available if you type \"status\"."
status()
loop do
input = gets.chomp()
pp input
case input.downcase!
when "help"
help()
when "move"
def move(direction) #Returns what the new coords would be, Sokoban.handle_move then checks if these are valid
pp @coordinates
case direction.downcase!
when "up"
move_up()
when "down"
move_down()
when "right"
move_right()
when "left"
@JamesZoft
JamesZoft / shooter.rb
Created April 19, 2012 09:26
2d shooter
#!/usr/bin/env ruby
require 'rubygems'
require 'gosu'
require 'pp'
class GameWindow < Gosu::Window
def initialize
super 640, 480, false
@JamesZoft
JamesZoft / game.rb
Created April 19, 2012 15:24
Asteroids....sorta
#!/usr/bin/env ruby
require 'rubygems'
require 'gosu'
require 'pp'
class GameWindow < Gosu::Window
attr_accessor :bullets, :stars
#!/usr/bin/env ruby
require 'gosu'
require 'pp'
class GameWindow < Gosu::Window
attr_reader :tilemap
def initialize
#!/usr/bin/env ruby
require 'gosu'
require 'pp'
class GameWindow < Gosu::Window
attr_reader :tilemap
def initialize
#!/usr/bin/env ruby
require 'gosu'
require 'pp'
class GameWindow < Gosu::Window
attr_reader :tilemap
def initialize