View assignment.rb
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 ruby | |
require "fileutils" | |
require "json" | |
ZOOKEEPER = raise "Put your zookeeper list here" | |
DEFAULT_BROKER_LIST = raise "put your broker list here (1,2,3) | |
FileUtils.rm_f "/tmp/topics.json" | |
FileUtils.rm_f "/tmp/assignment.json" |
View lifetime_value.rb
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
# Customer Acquisition Cost | |
@total_cac = 5_000.0 | |
@discounts = 1_000.0 | |
@new_customers = 30 | |
@cac = | |
(@total_cac + @discounts) / @new_customers | |
puts "Customer Acquisition Cost: #{@cac}" |
View benchmark.rb
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 "benchmark" | |
puts(Benchmark.measure { | |
1_000_000.times do | |
1 + 1 | |
end | |
}) | |
puts(Benchmark.measure { | |
1_000_000.times do |
View Gemfile
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
source 'https://rubygems.org' | |
gem "appsignal" |
View Gemfile
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
source 'https://rubygems.org' | |
gem 'sequel' | |
gem 'sqlite3' | |
gem 'appsignal' |
View example.rs
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
use std::env; | |
fn main() { | |
let first = env::args().nth(1); | |
match first { | |
Some(ref value) if value == "create" => println!("in create"), | |
Some(_) => println!("smt else"), | |
None => println!("No arg given") | |
} | |
} |
View screenshots.rake
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
BROWSER_WIDTH = 1600 | |
BROWSER_HEIGHT = 1200 | |
Capybara.default_driver = :selenium | |
include Capybara::DSL | |
def take_screenshot(path, name, convert_options={}) | |
# Wait for JS to load data and so on | |
sleep 2 | |
retinafy_screen |
View gist:2652300
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
scenario "make sure this feature is removed after July 1st" do | |
raise('Remove this feature!') if Time.now > Time.parse('2012-07-01') | |
end |
View gist:1391107
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
def select_from_chosen(item_text, options) | |
field = find_field(options[:from]) | |
option_value = page.evaluate_script("$(\"##{field[:id]} option:contains('#{item_text}')\").val()") | |
page.execute_script("$('##{field[:id]}').val('#{option_value}')") | |
end |
View gist:296000
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 Tosti | |
def self.validate(*ingredients, preparation_method) | |
ingredients.include?(:brood) && ingredients.length > 1 && preparation_method == :grill | |
end | |
end |
NewerOlder