Skip to content

Instantly share code, notes, and snippets.

@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

@mistersourcerer
mistersourcerer / js
Last active August 29, 2015 14:01
A "sane"(?) way to "play" http://game.notch.net/drowning
// go to http://game.notch.net/drowning
// open the console
// type this:
function sleep(millis, callback) {
setTimeout(function()
{ callback(); }
, millis);
}
@mistersourcerer
mistersourcerer / 01_loading_an_inexistent_gem.sh
Created April 15, 2014 03:18
trying to load an inexistent gem
$ pry
[1] pry(main)> gem "borba"
Gem::LoadError: Could not find 'borba' (>= 0) among 18 total gem(s)
from /Users/ricardovaleriano/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs'
@mistersourcerer
mistersourcerer / 01_forcing_gem_version_in_load_path.sh
Last active August 29, 2015 13:59
gem method, from rubygems, to force a gem version in the load path.
$ gem list | grep rake
rake (10.2.2, 0.9.6)
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