This file contains 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
# Rough Implementation of the pattern found here: https://medium.com/aws-activate-startup-blog/practical-vpc-design-8412e1a18dcc | |
provider "aws" { | |
region = "us-east-1" | |
} | |
# create a vpc | |
resource "aws_vpc" "shaselton" { | |
cidr_block = "10.0.0.0/16" | |
enable_dns_hostnames = true |
This file contains 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
### Keybase proof | |
I hereby claim: | |
* I am shaselton on github. | |
* I am shaselton (https://keybase.io/shaselton) on keybase. | |
* I have a public key ASAeh-Uh7Pbawb8aS8FoTBkIR9-0KY8fX8m8GzXyBenAcwo | |
To claim this, I am signing this object: |
This file contains 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
# Bob is preparing to pass IQ test. The most frequent task in this test is | |
# to find out which one of the given numbers differs from the others. Bob | |
# observed that one number usually differs from the others in evenness. | |
# Help Bob — to check his answers, he needs a program that among the given | |
# numbers finds one that is different in evenness, and return a position of this number. | |
# ! Keep in mind that your task is to help Bob solve a real IQ test, which | |
# means indexes of the elements start from 1 (not 0) | |
# Examples : | |
# iq_test("2 4 7 8 10") => 3 // Third number is odd, while the rest of the numbers are even |
This file contains 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
# Create a simple calculator that given a string of operators (+ - * and /) | |
# and numbers separated by spaces returns the value of that expression | |
# Example: | |
# Calculator.new.evaluate("2 / 2 + 3 * 4 - 6") # => 7 | |
# Remember about the order of operations! Multiplications and divisions have | |
# a higher priority and should be performed left-to-right. Additions and | |
# subtractions have a lower priority and should also be performed left-to-right. |
This file contains 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
# Description: | |
# Implement a function called makeAcronym that returns the first letters of each word in a passed in string. | |
# Make sure the letters returned are uppercase. | |
# If the value passed in is not a string return 'Not a string' | |
# If the value passed in is a string which contains only characters other than spaces and alphabet letters, return 'Not letters' | |
# EXAMPLES: | |
# 'Hello codewarrior' -> 'HC' | |
# '42' -> 'Not letters' |
This file contains 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 validBraces(string) | |
opening_character = ['(', '[', '{'] | |
closing_character = [')', ']', '}'] | |
string.split('').each_with_object([]) do |character, stack| | |
if opening_character.include?(character) | |
stack << character | |
else | |
return false if closing_character.index(character) != opening_character.index(stack.pop) | |
end |
This file contains 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 parse_hash_tags(str) | |
str.split(' ').select{ |word| /^#+([a-zA-Z])/.match(word) }.map{ |hash_tag| hash_tag.gsub(/^#+/, '') } | |
end |
This file contains 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 leftpad(str, len, ch = '') | |
return str if str.size >= len | |
(Array.new(len - str.size, ch) + str.split('')).join('') | |
end | |
puts leftpad('hello', 10, 'w') |