Skip to content

Instantly share code, notes, and snippets.

View codabrink's full-sized avatar

Dakota Brink codabrink

View GitHub Profile
<%= f.select :state_id, State.all.sort{|u,v|u.name<=>v.name}.collect {|s| [s.abbr+", "+s.name, s.id]}, "data-native-menu" => "false" %>
<!DOCTYPE html>
<html>
<head>
<title>Market</title>
<link href="/stylesheets/jquery.mobile-1.0b1.css?1309549151" media="screen" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" />
Started GET "/merchants/1/new_item" for 127.0.0.1 at 2011-07-03 22:59:02 -0700
Processing by MerchantsController#new_item as JS
Parameters: {"id"=>"1"}
User Load (0.2ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1
Completed in 52ms
ActionView::MissingTemplate (Missing template merchants/new_item with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:touch], :locale=>[:en, :en]} in view paths "/srv/rails/market/app/views", "/usr/lib/ruby/gems/1.9.1/gems/devise-1.4.2/app/views"):
app/controllers/merchants_controller.rb:33:in `new_item'
Rendered /usr/lib/ruby/gems/1.9.1/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/missing_template.erb within rescues/layout (0.5ms)
Market::Application.routes.draw do
root :to => "home#index"
match ':device_type/:controller(/:action(/:id(.:format)))'
devise_for :users
resources :users
resources :merchants do
resources :merchant_items
var clouds;
$(document).ready(function() {
clouds = $('.cloud');
$.each(clouds, function(index, value) {
animateCloud(value);
});
});
function animateCloud(cloud, speed, style) {
the intention of step is so that u dont have
to recreate repetitive modifier groups, u can
instead assign a modifier group to a menu
item and assign a display order to that
modifier group.
or say you have an item like a steak that
comes with 2 side items and temperature and style,
and u can set in which order those "steps" are
displayed to the user...the user first chooses
puts "Please input two numbers to add together." #puts is another way to print text to the screen, just like print.
puts "First number:"
a = gets.to_i #notice that I call .to_i on the gets statement to convert the input into a number
puts "Second number:"
b = gets.to_i #I do the same thing here.
c = a + b
puts a.to_s + " + " + b.to_s + " = " + c.to_s #notice that I call .to_s to convert the numbers to a string. And I join the strings together with a + sign.
#This solution is only an example and doesn't have to be concrete. Caleb can change it to how he wants it to function, and he can play around with additional functionality if he likes. =)
print "Hello, what's your name?\n"
name = gets.downcase.chomp
#Adding .downcase to the gets function turns "MoM" into "mom" for example.
#When you press enter upon entering your name it adds a special character to the end called a "newline" character.
#A newline character looks like this: \n
#We don't need this invisible character, so we remove it with the .chomp method.
@codabrink
codabrink / gist:1309503
Created October 24, 2011 16:55
NMLParse.rb
require "rexml/document"
require "NMLParse/song"
class NMLParse
attr_accessor :songs
def initialize
@songs = []
end
class Plateau
def initialize(height, width)
@rovers = []
$width = width
$height = height
end
def add_rover(x, y, h)
@rovers << Rover.new(x, y, h)
require 'minitest/autorun'
class TestRover < MiniTest::Unit::TestCase
def test_rover_operation
@plateau = Plateau.new(5,5)
@plateau.add_rover(1, 2, 'N')
result = @plateau.direct_rover("LMLMLMLMM")
assert_equal result, '1 3 N'