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
require 'pp' |
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
{foo: "bar", baz: "qux", quux: "corge", grault: "garply"}.slice(:foo, :grault) | |
=> {:foo=>"bar", :grault=>"garply"} |
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
# Before | |
irb(main):001:0> class Auth; end | |
=> nil | |
irb(main):002:0> class Twitter; end | |
=> nil | |
irb(main):003:0> Twitter::Auth | |
(irb):4: warning: toplevel constant Auth referenced by Twitter::Auth | |
# After | |
irb(main):001:0> class Auth; 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
2.tap {|x| x*2 } | |
=> 2 | |
2.yield_self {|x| x*2 } | |
=> 4 |
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
# Before you had to use begin | |
lambda do | |
begin | |
raise 'err' | |
rescue | |
$! # => #<RuntimeError: err> | |
end | |
end.call | |
# Now you can simply use rescue |
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
Customer = Struct.new(:name, :address, keyword_init: true) | |
Customer.new(name: "Dave", address: "123 Main") | |
#=> #<struct Customer name="Dave", address="123 Main"> |
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
#!/bin/bash | |
i=0 | |
while [ $? == 0 ] | |
do | |
i=$((i+1)) | |
curl https://registry.hub.docker.com/v2/repositories/library/ruby/tags/?page=$i 2>/dev/null|jq '."results"[]["name"]' | |
done |
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
FROM elixir:1.5.0 | |
WORKDIR /app | |
# Install Hex | |
RUN mix local.hex --force | |
# Install rebar3 | |
# Needed to compile dependency :ranch | |
RUN mix local.rebar --force |
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
#!/bin/sh | |
# This Script aims to setup a docker environment for Linux or OSX with docker client, docker-machine and docker-compose | |
# All binaries are install in /usr/local/bin/ directory. | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
NC='\033[0m' # No Color | |
os=$(uname -s) | |
arch=$(uname -m) |
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
var hash = document.location.hash.replace('#', ''); | |
$('a[data-target='+hash+']').trigger('click'); |