This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in test_helper.rb (for example) | |
def mock_env(partial_env_hash) | |
old = ENV.to_hash | |
ENV.update partial_env_hash | |
begin | |
yield | |
ensure | |
ENV.replace old | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Local tunnel to connect to remote DB via bastion ec2 instance | |
ssh -N -L 5433:DBHOSTNAME.eu-west-1.rds.amazonaws.com:5432 [email protected] | |
# then connects to db locally with localhost:5433 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme", | |
"font_face": "Fira Code", | |
"font_size": 15, | |
"ignored_packages": | |
[ | |
"Vintage" | |
], | |
"rubocop_path": "~/.rbenv/shims/rubocop --config ~/.rubocop.yml", | |
"ruby_path": "~/.rbenv/shims/ruby", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set a badge with a hostname | |
# Also sets a bg color when in prod | |
function warnssh() { | |
printf "\e]1337;SetBadgeFormat=%s\a" $(echo -n $1 | base64) | |
if [[ $1 =~ "^prod-.*" ]] ; then | |
echo -e "\033]1337;SetColors=bg=612c62\a" | |
fi | |
ssh $* | |
printf "\e]1337;SetBadgeFormat=%s\a" "" | |
echo -e "\033]1337;SetColors=bg=000\a" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Instructions: run with rspec coin_change.rb | |
# | |
# | |
# Making Change | |
# Given a number "x" and a sorted array of coins "coinset", write a function | |
# that returns the amounts for each coin in the coinset that sums up to X or | |
# indicate an error if there is no way to make change for that x with the given | |
# coinset. For example, with x=7 and a coinset of [1,5,10,25], a valid answer | |
# would be {1: 7} or {1: 2, 5: 1}. With x = 3 and a coinset of [2,4] it should | |
# indicate an error. Bonus points for optimality. |
OlderNewer