I hereby claim:
- I am ebtoulson on github.
- I am ebtoulson (https://keybase.io/ebtoulson) on keybase.
- I have a public key ASAr2WB4ioPmDytYD4fqXXqLS9GZ9PxyX3MT6LWVA4OqHQo
To claim this, I am signing this object:
# You can configure DSfix by editing this file | |
# Lines starting with "#" are ignored by the program and contain descriptions of the options | |
############################################################################### | |
# Graphics Options | |
############################################################################### | |
# internal rendering resolution of the game | |
# higher values will decrease performance | |
renderWidth 2560 |
I hereby claim:
To claim this, I am signing this object:
ingredients = IO.read("./15_ingredients.txt").split("\n").map do |line| | |
name, *ingred_list = /(.+): .* (.*), .* (.*), .* (.*), .* (.*), .* (.*)/.match(line).captures | |
{name => ingred_list.map(&:to_i)} | |
end.inject({}) { |nh, oh| nh.merge!(oh)} | |
recipes = ingredients.keys.repeated_combination(100).map do |combo| | |
ingredients.keys.map do |i| | |
[i, combo.count{|ing| ing == i}] | |
end | |
end |
class HttpRequestBase | |
HTTP_VERBS = [:get, :post, :delete, :put].freeze | |
attr_reader :response, :timeout | |
def initialize(args={}) | |
@timeout = args[:timeout] || default_timeout | |
post_initialize(args) | |
end |
guard :minitest do | |
watch(%r{^test/(.*)\/?_test(.*)\.rb$}) | |
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[2]}_test.rb" } | |
watch(%r{^test/test_helper\.rb$}) { 'test' } | |
end |
class Bottles | |
attr_reader :where, :substance | |
def initialize(substance='of beer', where='on the wall') | |
@substance = substance | |
@where = where | |
end | |
def verse bottle_number | |
next_bottle_number = bottle_number - 1 |
class House | |
LYRICS = [ | |
"This is the house that Jack built.", | |
"This is the malt that lay in the house that Jack built.", | |
"This is the rat that ate the malt that lay in the house that Jack built.", | |
"This is the cat that killed the rat that ate the malt that lay in the house that Jack built.", | |
"This is the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.", | |
"This is the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.", | |
"This is the maiden all forlorn that milked the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.", | |
"This is the man all tattered and torn that kissed the maiden all forlorn that milked the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jac |
def char_occurrence str | |
str.split('').chunk{|x| x}.map do |letter, chunk| | |
[chunk.count, letter] | |
end.join | |
end | |
#second format | |
def char_occurrence str | |
str.split('').chunk{|x| x}.map do |letter, chunk| | |
chunk.join.capitalize |
require 'json' | |
require 'cgi' | |
server = "localhost:8098" | |
bucket = "portal_development_tokens" | |
request = `curl http://#{server}/buckets/#{bucket}/keys?keys=true` | |
keys = JSON.parse(request)["keys"] | |
keys.each do |key| |
class HealthCheck | |
class << self | |
def check! | |
status = { | |
service: service_working?, | |
db: db_connected? | |
} | |
[status.values.all?, status] | |
rescue e | |
[false, :exception => e.message] |