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
def method_missing(name, *args) | |
args.reduce {|a,b| a + b } | |
end | |
puts(sum 1,2,3,4,5) |
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
a = [1,2,3, nil] | |
b = a.first | |
if b # Create a branch of nil/not_nil | |
puts b + 1 | |
else | |
puts "B is nil" | |
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
a = [1,2,3, nil] | |
if a[0] | |
puts a[0] + 1 # This doesn't work | |
end | |
puts a[0].not_nil! + 1 # This does though |
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
# Declaring arrays and hashes that can have nils and have either strings or ints | |
array = [] of Int32|String? | |
hash = {} of String => Int32|String? | |
alias A = Int32|String? | |
array_2 = [] of 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
# Declaring arrays and hashes that can have nils | |
array = [] of Int32? | |
hash = {} of String => Int32? |
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
# Declaring empty Int array and hashes | |
array = [] of Int32 | |
hash = {} of String => Int32 |
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
#!/usr/bin/env python | |
import socket | |
import sys | |
# Create a TCP/IP socket | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
# Bind the socket to the port | |
server_address = ('localhost', 8125) |
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
#!/usr/bin/env ruby | |
require 'json' | |
USAGE = "USAGE:\ngit ticket TICKET_ID\n" | |
# get ticket ID from first command line argument | |
ticket_id = ARGV[0] | |
unless ticket_id | |
print USAGE |
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
#!/usr/bin/env ruby | |
# Needs https://github.com/schacon/git-pulls to work | |
current_branch = %x(git rev-parse --abbrev-ref HEAD).sub("\n","") | |
repo_url = %x(git config --get remote.origin.url).sub(".git\n", '') | |
%x(git pulls update) | |
pull_requests = %x(git pulls list) | |
possible_pull_request = pull_requests.split("\n").grep(Regexp.new(current_branch)) | |
has_pull_request = !possible_pull_request.empty? |
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
version: '2' | |
services: | |
postgres: | |
ports: | |
- "5432:5432" | |
image: postgres | |
redis: | |
ports: | |
- "6379:6379" | |
image: redis |