Skip to content

Instantly share code, notes, and snippets.

View jkthorne's full-sized avatar
💭
caffeinated

Jack jkthorne

💭
caffeinated
View GitHub Profile
Error in ./main.cr:51: instantiating 'Polish::CLI:Class#run()'
Polish::CLI.run
^~~
in ./main.cr:14: instantiating 'Polish::CLI#run()'
new.run
^~~
@jkthorne
jkthorne / crystal-tags.cr
Created March 8, 2019 06:39 — forked from datanoise/crystal-tags.cr
ctags for crystal language
require "compiler/crystal/**"
require "option_parser"
include Crystal
class ToCtagsVisitor < Visitor
@filename : String
@lines : Array(String)
@io : IO
@opts : Generator
@jkthorne
jkthorne / 00-README.md
Created March 8, 2019 06:39 — forked from rf-/00-README.md
Crystal ctags generator

To compile with Homebrew-installed LLVM:

PATH=/usr/local/opt/llvm/bin:$PATH crystal build crystal-tags.cr
require "benchmark"
module Enumerable
def j8r_join(separator, io)
first = true
each do |elem|
io << separator unless first
yield elem, io
first = false
end
@jkthorne
jkthorne / xml bug
Created February 21, 2021 18:15
xmll bug
require "xml"
xml = XML.parse <<-XML
<?xml version="1.0" encoding="UTF-8"?>
<transaction>
<id>fj6df5n1</id>
<status>submitted_for_settlement</status>
<type>sale</type>
<currency-iso-code>USD</currency-iso-code>
<amount>9363.36</amount>
@jkthorne
jkthorne / benchmark.cr
Last active July 16, 2021 17:57
benchmark array v static array
require "benchmark"
std_array_sm = Array(Int32).new(8) { rand(0..1000) }
std_array_md = Array(Int32).new(16) { rand(0..1000) }
std_array_lg = Array(Int32).new(32) { rand(0..1000) }
std_array_xlg = Array(Int32).new(64) { rand(0..1000) }
std_array_xxlg = Array(Int32).new(128) { rand(0..1000) }
static_array_sm = StaticArray(Int32, 8).new { rand(0..1000) }
static_array_md = StaticArray(Int32, 16).new { rand(0..1000) }
static_array_lg = StaticArray(Int32, 32).new { rand(0..1000) }