I hereby claim:
- I am asaaki on github.
- I am asaaki (https://keybase.io/asaaki) on keybase.
- I have a public key ASBo4idVp9JxHEySo-IQ8g3-CFIvbUj93GGL_H8j8YpURwo
To claim this, I am signing this object:
Code.compiler_options(ignore_module_conflict: true) | |
base_dir = "web/models" | |
if File.exists?(base_dir) do | |
for model_file <- File.ls!(base_dir) do | |
for {mod, _bytes} <- Code.load_file(model_file, base_dir) do | |
Code.eval_quoted(quote(do: alias unquote(mod)), [mod: mod]) | |
end | |
end | |
end | |
Code.compiler_options(ignore_module_conflict: false) |
# frozen_string_literal: true | |
# Gemfile: | |
# # frozen_string_literal: true | |
# source 'https://rubygems.org' | |
# gem 'benchmark-ips' | |
require 'bundler/setup' | |
require 'benchmark/ips' | |
require 'set' |
I hereby claim:
To claim this, I am signing this object:
[some_data.fetch('a_string', fallback_string)].reduce(replacer) { |r, s| s == criteria ? r : s } | |
# or a way simpler workaround: | |
(origin = some_data.fetch('a_string', fallback_string)) == criteria ? replacer : origin |
N people come to a river in the night. There is a narrow bridge, but it can only hold two people at a time. The have one torch and, because it's night, the torch has to be used when crossing the bridge. Each person takes a variable amount of time to cross.
When two people cross the bridge together, they must move at the slower person's pace.
The question is, how fast can you get N people across the bridge?
(Found via ).
# Excludes the active branch + master and production | |
git branch --merged | \ | |
grep -v -e "\*" -e master -e production | \ | |
xargs -n1 git branch -d |
module M💩 | |
module_function | |
def 🔫 | |
puts '💥' | |
end | |
end | |
M💩.🔫 |
# path to the jemalloc shared lib | |
LD_PRELOAD=/usr/lib/libjemalloc.so bundle exec rails server | |
# Also see: https://github.com/kzk/jemalloc-rb/issues/3 |
# Condensed from http://blog.arkency.com/2015/09/testing-race-conditions/ | |
wait_lock = true | |
threads = 5.times.map do |i| | |
Thread.new do | |
:noop while wait_lock # shortest no-op loop with break. Nice!* | |
begin | |
puts "Hooray from thread #{i}!" # Your awesome thread business logic here |
#!/bin/sh | |
# Shamelessly stolen from: | |
# https://github.com/michaeldfallen/git-radar/blob/master/git-radar#L7-L13 | |
if [[ "$OSTYPE" == *darwin* ]]; then | |
READLINK_CMD='greadlink' | |
else | |
READLINK_CMD='readlink' | |
fi |