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 GistTest | |
def test(foo='bar') | |
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 'pusher-client' | |
socket = PusherClient::Socket.new('5df8ac576dcccf4fd076') | |
socket.subscribe('common') | |
handler = lambda do |event, data| | |
p [event, data] | |
end | |
events = ['job:created', 'job:started', 'job:finished', 'job:canceled', |
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
<!doctype html> | |
<html> | |
<head> | |
<title>My Little Webapp: Coding Is Magic</title> | |
<meta charset="UTF-8" /> | |
<link rel="stylesheet" href="https://rawgithub.com/krzysztofbialek/Rails-Girls-Warsaw-App/master/style.css" /> | |
</head> | |
<body> | |
</body> | |
</html> |
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
this.resource("restaurants") | |
this.resource("restaurant", { path: "/restaurants/:restaurant_id" }, function () { | |
this.resource("bookings", function () { | |
this.route("new"); | |
}); | |
this.resource("booking", { path: "/bookings/:booking_id" }); | |
}); |
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 PostForm | |
include Virtus.model | |
extend ActiveModel::Naming | |
include ActiveModel::Validations | |
attribute :id, Integer | |
attribute :title, String | |
attribute :body, String | |
validates :title, presence: true |
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
Capybara.register_driver :selenium_with_long_timeout do |app| | |
client = Selenium::WebDriver::Remote::Http::Default.new | |
client.timeout = 120 | |
Capybara::Selenium::Driver.new(app, :browser => :firefox, :http_client => client) | |
end | |
Capybara.javascript_driver = :selenium_with_long_timeout |
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
#!/usr/bin/env python | |
import time | |
from pyo import * | |
s = Server(duplex=0).boot() | |
s.start() | |
left = [ | |
Sine( phase = 0.25, freq = 400, mul = 0.5 ), |
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 ActiveRecord::Base | |
# Returns hash prepared to be converted to json | |
# | |
# Can take the same options as ActiveRecord::Base#to_json | |
def prepare_json(options = {}) | |
if include_root_in_json | |
{ self.class.json_class_name => JsonSerializer.new(self, options).serializable_record } | |
else | |
JsonSerializer.new(self, options).serializable_record | |
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
Ruby 1.8.6 | |
| AR 2.2.1 | DM 0.9.7 | DIFF | | |
---------------------------------------------------------------------------------------- | |
Model.new (instantiation) x10000 | 0.541 | 0.049 | 11.02x | | |
Model.new (setting attributes) x10000 | 1.895 | 1.103 | 1.72x | | |
Model.get specific (not cached) x10000 | 9.964 | 19.736 | 0.50x | | |
Model.get specific (cached) x10000 | 12.432 | 1.227 | 10.14x | | |
Model.first x10000 | 10.063 | 11.966 | 0.84x | | |
Model.all limit(100) x1000 | 23.322 | 25.645 | 0.91x | | |
Model.all limit(100) with relationship x1000 | 48.873 | 67.983 | 0.72x | |
OlderNewer