I hereby claim:
- I am j3rn on github.
- I am j3rn (https://keybase.io/j3rn) on keybase.
- I have a public key ASBhifQXfnaOXVcs8wkePXEhYqHf5sX7-XkL_U5IX_CALwo
To claim this, I am signing this object:
history | sed 's/\s\+[0-9]\+\s\+//' | cut -d ' ' -f 1 | sort | uniq -c | sort -n |
****** Process <0.91.0> -- 100.00 % of profiled time *** | |
FUNCTION CALLS % TIME [uS / CALLS] | |
-------- ----- ------- ---- [----------] | |
erl_eval:exprs/5 1 0.00 0 [ 0.00] | |
erl_eval:ret_expr/3 2 0.00 0 [ 0.00] | |
erl_eval:eval_fun/2 1 0.00 0 [ 0.00] | |
erl_eval:expr_list/4 1 0.00 0 [ 0.00] | |
erl_eval:guard/4 1 0.00 0 [ 0.00] | |
erl_eval:guard0/4 1 0.00 0 [ 0.00] | |
erl_eval:match_list/4 1 0.00 0 [ 0.00] |
sample = Enum.map(1..1000, &{&1, &1}) |> Map.new() | |
Benchee.run(%{ | |
"maps:map" => fn -> :maps.map(fn _k, v -> v * 2 end, sample) end, | |
"Map.new" => fn -> Map.new(sample, fn {k, v} -> {k, v * 2} end) end, | |
"for" => fn -> for {k, v} <- sample, into: %{}, do: {k, v * 2} end | |
}) |
pattern = %{foo: "bar", bar: %{baz: "qux"}} | |
good_data = %{foo: "bar", bar: %{baz: "qux", qux: "asdf"}} | |
bad_data = %{foo: "baz", bar: %{baz: "asdf"}} | |
### This is perfect | |
match?(%{foo: "bar", bar: %{baz: "qux"}}, good_data) | |
#=> true | |
match?(%{foo: "bar", bar: %{baz: "qux"}}, bad_data) | |
#=> false |
#!/bin/bash | |
# Usage: ./backup.sh <path to directory to archive> <GPG user> | |
tar -C $1 -c . | gpg --recipient $2 -e > $(date -Iminutes | tr -d ':').tar.gz.gpg |
# This script has been tested with zsh 5.2 on macOS 10.12.3 with BSD sed and find. | |
# It may work under other conditions, but likely does not. | |
# old2new, the Ruby hash syntax updating function | |
# Takes the given files and replaces all instances of `:key => value` with the equivalent `key: value` | |
# Usage: old2new <path> | |
# NOTE: <path> can be a file or directory | |
function old2new() { | |
find $argv \( -name "*.haml" -or -name "*.rb" -or -name "*.erb" \) -exec sed -E -i '' 's/:([A-z]+) =>/\1:/g' '{}' \; | |
} |
# USAGE: ruby proc_fix.rb <one or more space-separated model names without path or extension> | |
# e.g. ruby proc_fix.rb activity | |
# e.g. ruby proc_fix.rb accessory bill_charge | |
# **Must be run in Rail's root** | |
# What it do: Converts all "Proc.new { |foo|" to "(foo) -> {" | |
before = /scope(.*)Proc\.new\s*\{\s*\|(.*)\|/ | |
after = 'scope\1->(\2) {' | |
ARGV.each do |modelname| |
class Parser | |
ENCLOSURES = { | |
'"' => '"', | |
'(' => ')', | |
'{' => '}', | |
'[' => ']' | |
} | |
def initialize | |
@i = 0 |
I hereby claim:
To claim this, I am signing this object:
#!/bin/sh | |
GIT_REPO=$HOME/portfolio.git | |
TMP_GIT_CLONE=$HOME/tmp_portfolio | |
PUBLIC_WWW=$HOME/www | |
touch $HOME/deploy | |
git clone $GIT_REPO $TMP_GIT_CLONE | |
cp -rv $TMP_GIT_CLONE/* $PUBLIC_WWW | |
rm -rf $TMP_GIT_CLONE |