Skip to content

Instantly share code, notes, and snippets.

View cachrisman's full-sized avatar

Charlie Chrisman cachrisman

View GitHub Profile
@cachrisman
cachrisman / pretty-exception.rb
Created May 12, 2016 21:21 — forked from mikepfirrmann/pretty-exception.rb
Print a prettier stack trace for Ruby exceptions
def colorize(text, color_code)
"\e[#{color_code}m#{text}\e[0m"
end
begin
# Here be dangerous things.
rescue => e
print "\r" << (' ' * 50) << "\n"
stacktrace = e.backtrace.map do |call|
if parts = call.match(/^(?<file>.+):(?<line>\d+):in `(?<code>.*)'$/)
@cachrisman
cachrisman / data.csv
Last active February 10, 2022 14:59 — forked from grncdr/data.csv
Demo of importing a CSV file into a Contentful space
product name product description