Skip to content

Instantly share code, notes, and snippets.

View RespiteSage's full-sized avatar

Benjamin Wade RespiteSage

  • Washington D.C Metro Area, USA
View GitHub Profile
@RespiteSage
RespiteSage / terminal_prompts.cr
Created January 21, 2022 22:47
Crystal Terminal Prompt Helper Functions
def prompt_input(prompt_text, *, default = nil) : String
print prompt_text
if default
print %[ (default: "], default, %[")]
end
print " "
gets || default || ""
end
def prompt_integer_input(prompt_text)
@RespiteSage
RespiteSage / bit_array.cr
Created December 23, 2021 00:43
Crystal BitArray methods with benchmarks of different #fill implementations
require "benchmark"
require "bit_array"
require "intrinsics"
struct BitArray
def self.new(size, & : Int32 -> Bool)
instance = BitArray.new(size)
(0...size).each do |i|
instance[i] = yield i
end

Keybase proof

I hereby claim:

  • I am respitesage on github.
  • I am respitesage (https://keybase.io/respitesage) on keybase.
  • I have a public key ASCUBHTPgN9J8lDXsDLOWOZSj0oZyvl-EsxBJmZhbKqu3Qo

To claim this, I am signing this object: