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
// options already generated above | |
_oidcClient = new OidcClient(options); | |
var audienceApi = "http://localhost:7071/api/SayMyName/"; | |
var audience = new Dictionary<string, string> | |
{ | |
{ "audience", audienceApi } | |
}; |
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
class LogicCalculator | |
attr_accessor :lines | |
def initialize | |
data = File.read("lib/input.txt") | |
@lines = data.split("\n") | |
end | |
def calculate_result |
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 'logic_calculator' | |
describe "Integration Test" do | |
subject(:logic_calculator) { LogicCalculator.new } | |
before(:each) do | |
@file_challenge1 = File.read("lib/input.txt") | |
@file_challenge2 = File.read("lib/input2.txt") | |
@RESULT1 = 16076 | |
@RESULT2 = 2797 | |
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
require 'logic_calculator' | |
describe LogicCalculator do | |
subject(:logic_calculator) { described_class.new } | |
before(:each) do | |
@f = File.read("lib/input.txt") | |
@lines = @f.split("\n") | |
end | |
context "File management" do |
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 process_command2(command,i,j) | |
case command | |
when "toggle" | |
@grid[i][j] += 2 | |
when "on" | |
@grid[i][j] += 1 | |
when "off" | |
@grid[i][j] >=1 ? @grid[i][j]-= 1 : 0 | |
else | |
raise "command error" |
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
class Day6 | |
attr_reader = :lighted | |
def initialize | |
@grid = Array.new(1000) {Array.new(1000,0)} | |
@lighted = 0 | |
end | |
def get_raw_data |
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
sergio@linux ~/Ronin/Tech-tests/babylon (wip *) | |
$ irb | |
2.3.1 :001 > item1 = Item.new(code: :"001", name: "Lavender heart", price: 9.25) | |
=> #<Item:0x00000001c81468 @code=:"001", @name="Lavender heart", @price=9.25> | |
2.3.1 :002 > item2 = Item.new(code: :"002", name: "Personalised cufflinks", price: 45) | |
=> #<Item:0x00000001c64548 @code=:"002", @name="Personalised cufflinks", @price=45> | |
2.3.1 :003 > item3 = Item.new(code: :"003", name: "Kids T-shirt", price: 19.95) | |
=> #<Item:0x00000001c16ed8 @code=:"003", @name="Kids T-shirt", @price=19.95> | |
2.3.1 :004 > promo1 = Promotion.new(id: :promo1, type: :"multiple_buy", params: { code: :"001", quantity: 2, promo_price: 8.50 }) | |
=> #<Promotion:0x00000001a802e0 @id=:promo1, @type=:multiple_buy, @params={:code=>:"001", :quantity=>2, :promo_price=>8.5}> |
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
class CheckNiceWords | |
FILE = "day5/day5.txt" | |
THREE_VOWELS = /[aeiou].*?[aeiou].*?[aeiou]/ | |
REPEATED_CHARS = /(.)\1+/ | |
NOT_AB = /^((?!ab).)*$/ | |
NOT_CD = /^((?!cd).)*$/ | |
NOT_PQ = /^((?!pq).)*$/ | |
NOT_XY = /^((?!xy).)*$/ |
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 'digest/md5' | |
class Miner | |
ZEROS = 6 | |
def mine(secret) | |
result = "" | |
i = 0 | |
loop do |
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 'digest/md5' | |
class Miner | |
def mine(secret) | |
result = "" | |
i = 0 | |
loop do | |
i+=1 | |
result = Digest::MD5.hexdigest(secret + i.to_s) |
NewerOlder