Skip to content

Instantly share code, notes, and snippets.

View metavida's full-sized avatar

Marcos Wright-Kuhns metavida

View GitHub Profile
@metavida
metavida / glass-half-empty.sh
Last active August 13, 2016 21:49
Answers to the question: Does (-1%7) resolve to -1 or 6?
$ node --version
v5.6.0
$ node -e "console.log(-1 % 7)"
-1
$ bc --version
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
$ echo "-1 % 7 "| bc
-1
@metavida
metavida / benchmark_gsub_heredoc.rb
Created August 26, 2016 17:37
gsub in heredoc benchmark
def plain
<<-ERR
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
ERR
end
@metavida
metavida / instructions.sh
Created October 12, 2016 15:33
compile openssl for ruby
# The following instructions allowed me to isntall a custom version of OpenSSL
# along-side any existing versions
# and then re-compile ruby using rvm so that the custom OpenSSL was used.
openssl_version='1.0.2j'
# Get openssl
cd ~root/src/
wget https://www.openssl.org/source/openssl-${openssl_version}.tar.gz