This file contains 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
# KOntroller: | |
class AuctionsController | |
# .... | |
def create | |
@auction = params[:auction][:type].constantize.new(params[:auction].merge(:calendar_validation => true, :private => false)) | |
if @auction.save | |
redirect_to auction_products_path( @auction ) |
This file contains 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
# Selenium, capybara - a way to click on a div | |
Then /^I click on "([^\"]*)" inside "([^\"]*)"$/ do |class_name, within| | |
locate(:css, "#{within} > #{class_name}").click | |
end |
This file contains 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
module B | |
def a | |
"a" | |
end | |
end | |
B.a #=> undefined method | |
module B |
This file contains 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
$("#section_to_refresh").load(url+' #section_to_refresh>*','', function () { | |
$(".items_with_events").click(function() { | |
doStuff(); | |
}); | |
}); |
This file contains 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
$(documment).unbind(".namespace"); | |
$("#section_to_refresh").load(url+' #section_to_refresh>*',''); | |
$(".items_with_events").click(function() { | |
// .... | |
}); |
This file contains 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
class A | |
class << self | |
def foo | |
puts "foo" | |
end | |
end | |
end | |
A.foo |
This file contains 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
fib = Fiber.new do | |
v = 0 | |
loop do | |
v += 1 | |
Fiber.yield v | |
v.times { print "-"} | |
puts v | |
end | |
end |
This file contains 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 'fiber' | |
def event_callback(letter) | |
puts "I've encountered #{letter} !!" | |
end | |
f = Fiber.new do | |
('a'..'z').each do |l| | |
Fiber.yield(event_callback(l)) if (l == "c" || l == "h") | |
end |
This file contains 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
test("booking gets proper starting coordinates at the begining", function() { | |
expect(2); | |
var event = jQuery.Event("mousedown.calendar"); | |
event.pageX = 100; | |
event.pageY = 200; | |
jQuery(".weekday > .event_box").first().trigger(event); | |
equals(booking.startX, 100, "startX"); | |
equals(booking.startY, 200, "startY"); | |
}); |
This file contains 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
var drawEvents = function() { | |
var popupExists = function (target) { | |
return !!jQuery(target).find("#sender").length; | |
}; | |
var getLocationId = function(slots) { | |
if (!slots) { | |
return jQuery("#location_id").text(); | |
} else { |
OlderNewer