Skip to content

Instantly share code, notes, and snippets.

@mistersourcerer
mistersourcerer / color.sh
Created October 10, 2012 15:06
Colorizing Ruby [or other lang] code from command line, to paste in keynote
#!/bin/bash
#http://pygments.org/docs/cmdline/
LANG="ruby"
if [ -n "$2" ]
then
LANG=$2;
fi
@mistersourcerer
mistersourcerer / already_knew.md
Last active June 28, 2019 08:36
but if you already knew it...

So I am reading this TODO comment...

And I see you know exactly what is wrong with it and also the general direction to make it better.

It EVEN has a section LOW HANGING FRUITS on it! WHY THE DEUCE didn't you made it right out of the gate, then!?!?!?!?

I feel your pain and this is why I left the comment in the first place. I was thinking about you, fellow colleague!

# the return of the one, is the param of the next
one = ->(value) { puts "received #{value}"; 1 }
two = ->(value) { puts "received #{value}"; 2 }
three = ->(value) { puts "received #{value}"; 3 }
done = one >> two >> three
puts "-" * 10
puts "finalizing #{done.call("calling")}"
puts "-" * 10
# for example...
@mistersourcerer
mistersourcerer / console
Last active January 4, 2019 18:01
#_reload method for standard gem `bin/console`
#!/usr/bin/env ruby
require "bundler/setup"
require "awesome_gem"
def _app_path
@app_path ||= File.expand_path "../../lib/", __FILE__
end
def _load
@mistersourcerer
mistersourcerer / Gemfile
Created December 6, 2018 15:26
Easy way to visually see what happens if you FORK with(in) a web process/request.
gem "rack"
@mistersourcerer
mistersourcerer / CHANGELOG.md
Last active July 3, 2018 09:21
Progammer's Path Mentoring Thingy

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog.

[Unreleased]

[0.1.0] - 2018-07-03

IOError:
Couldn't load the Unicode tables for UTF8Handler (No such file or directory - /Users/valeriano/.rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/values/unicode_tables.dat), ActiveSupport::Multibyte is unusable
require "webrick"
server = WEBrick::HTTPServer.new Port: 3000, DocumentRoot: Dir.pwd
trap("INT") { server.shutdown }
server.start
@mistersourcerer
mistersourcerer / 1_9_3.sh
Last active December 18, 2015 01:08
rbenv + ruby 2
CC=/usr/local/bin/gcc RUBY_CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl`" rbenv install 1.9.3-p429
@mistersourcerer
mistersourcerer / oparake.rb
Created May 27, 2013 22:03
Loading rake tasks vamo que vamo oi oi oi!
# encoding: utf-8