This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= $thing %> | |
<form action='/thing1' method='post' > | |
<input type='hidden' name='_method' value='put'> | |
<input type='submit' value='Upvote'> | |
<form action='/thing2' method='post' > | |
<input type='hidden' name='_method' value='put'> | |
<input type='submit' value='Downvote'> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def string_thing(string) | |
holding_array = [] | |
unless string.empty? | |
holding_array << String.new(string.slice! (0..249)) | |
end | |
return holding_array | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#fake animated status bar. | |
def sleep_dots(seconds) | |
seconds.times do | |
print "." | |
sleep(1) | |
end | |
return " " | |
end | |
#the response arrays. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def deal_cards | |
suit = [:hearts, :diamonds, :clubs, :spades] | |
return @all_cards[suit.sample].pop | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def new_deck | |
all_cards = {} | |
[:hearts, :diamonds, :clubs, :spades].each {|suit| all_cards[suit] = (1..13).to_a.shuffle!} | |
return all_cards | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://code.jquery.com/jquery-1.10.1.min.js"></script> | |
<script src="click.js"></script> | |
</head> | |
<body> | |
<h1>This should do something!!</h1> | |
</body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('h1').click -> | |
alert("You clicked this") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
CSV.foreach(filename, :headers => true) do |row| | |
Pokemon.create!(row.to_hash) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% if @user.errors.any? %> | |
<div id="error_explanation" > | |
<div class="alert alert-error"> | |
The form contains <%= pluralize(@user.errors.count, "error") %>. | |
</div> | |
<ul> | |
<% @user.errors.full_messages.each do |msg| %> | |
<li>* <%= msg %></li></br> | |
<% end %> | |
</ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array = [] | |
random_number = rand(5) + 5 | |
string = "" | |
walls_and_halls = ["W", "."] | |
(random_number * random_number + 1).times { string << walls_and_halls.sample } | |
string = string.chop! |