I hereby claim:
- I am jazzytomato on github.
- I am jazzytomato (https://keybase.io/jazzytomato) on keybase.
- I have a public key ASAmqKM9EXyy5yLsm9tLpJEObivFIzwlxe1tq18KEFvLywo
To claim this, I am signing this object:
| # 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. |
| # 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" |
| { | |
| "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", |
| # 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 |
| # 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 |
I hereby claim:
To claim this, I am signing this object:
| (defn wrap-query-params-spec [h] | |
| "Try to parse query params with clojure spec. Look for a spec named like 'query-params/[uri]' | |
| If found and the spec does not conform, return the explained message" | |
| (fn [req] | |
| (try | |
| (let [query-spec-k (keyword (str "query-params" (:uri req))) | |
| query-params (keywordize-keys (:query-params req)) | |
| conformed-query-params (s/conform query-spec-k query-params)] | |
| (if (= :clojure.spec/invalid conformed-query-params) | |
| (-> |
| # Enumerable extensions | |
| module Enumerable | |
| # this will be able to handle a pool of workers (actors) | |
| # can be useful to have a pool to limit the amount of concurrent work | |
| class ParallelWorker | |
| POOL_SIZE = ENV.fetch('CELLULOID_POOL_SIZE', [Celluloid.cores, 2].max).to_i | |
| include Celluloid | |
| def yielder(element, block) | |
| block.call(element) | |
| end |
| # Example for replace spec files modules: | |
| module MyFirstModule | |
| module MySecondModule | |
| describe Something do | |
| # code | |
| end | |
| end | |
| end |