I hereby claim:
- I am gevann on github.
- I am gevann (https://keybase.io/gevann) on keybase.
- I have a public key ASD0V2Ra4jpBH6WDKprT6EqPNMgrRfV0ZQ4jN1xhPk5x3go
To claim this, I am signing this object:
func Reduce[T any, R any](arr []T, fn func(acc R, val T) R) R { | |
var acc R | |
for _, v := range arr { | |
acc = fn(acc, v) | |
} | |
return acc | |
} |
I hereby claim:
To claim this, I am signing this object:
#!/bin/sh | |
echo | |
echo "Running CodeClimate" | |
CLIMATE_ISSUES=$(git --no-pager diff --diff-filter=ACMR --name-only master \ | |
| xargs codeclimate analyze \ | |
| tee /dev/tty \ | |
| tail -n 1 \ | |
| cut -f 4 -d' ') |
# Calculates what percentage of 'n' each element of 'arr' should have, by weight. | |
# | |
# @param arr [Array<#amount>] the array of objects to spread n across. | |
# @param n [Number] the amount to spread accross arr. | |
def adj(arr, n) | |
total = arr.inject(BigDecimal(0)) { |acc, memo| acc += memo.amount } | |
results = arr.map { |elem| (elem.amount / total).round(2) } | |
# ensure the last entry accounts for rounding | |
results[-1] = total - results[0...-1].inject(&:+) | |
arr.zip(results) |
python << endpython | |
import vim | |
import os | |
def other_file(): | |
return vim.eval("system(\"rg . --files -g '' | fzy \")") | |
def relpath(): | |
target = other_file() | |
relative_path = os.path.relpath(target, vim.current.buffer.name).strip() |