Skip to content

Instantly share code, notes, and snippets.

@mariapacana
mariapacana / nums_subtraction.rb
Created May 9, 2013 18:58
Converts integers to Roman numerals.
def numerals_subtraction(int)
values = %w(M D C L X V I)
roman_num = ""
values = {"M" => 1000, "D" => 500, "C" => 100, "L" => 50, "X" => 10, "V" => 5, "I" => 1}
values.keys.each do |i|
if (int % values[i]) then
@mariapacana
mariapacana / guessing_game.rb
Created April 25, 2013 17:24
Revised guessing game.
class GuessingGame
def initialize(answer)
@answer = answer
end
def guess(guess)
@guess = guess
if guess > @answer
puts "high"
return :high
@mariapacana
mariapacana / gist:5354325
Last active December 16, 2015 01:19
The first file is a Jasmine test, the second is the file I am trying to test. When I try to run both tests (one for adding a row and one for deleting a row), Jasmine gives me a "TypeError: Object is not a function" error. But if I comment out one of the tests and just run the other test, it works perfectly. Specifically, Jasmine says: TypeError:…
//The Jasmine test.
describe("A suite", function() {
var addFriendButton;
var removeFriendButton;
var contacts;
beforeEach(function() {
addFriendButton = document.createElement("button");
document.body.appendChild(addFriendButton);
addFriendButton.setAttribute("id", "addFriendButton");