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
#!/bin/bash | |
# This way you can customize which branches should be skipped when | |
# prepending commit message. | |
if [ -z "$BRANCHES_TO_SKIP" ]; then | |
BRANCHES_TO_SKIP=(master develop test) | |
fi | |
BRANCH_NAME=$(git symbolic-ref --short HEAD) | |
BRANCH_NAME="${BRANCH_NAME##*/}" |
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
// x,y is bottom left corner | |
var Rectangle = function Rectangle(x,y,w,h){ | |
this.x = x; | |
this.y = y; | |
this.width = w; | |
this.height = h; | |
} | |
// SOLUTION | |
var checkIntersect = function checkIntersect(r1,r2) { |
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 first_nonrepeated_char_eff( string ) | |
# Create a Hash with default values of 0 | |
char_counts = Hash.new( 0 ) | |
# Get rid of spaces | |
chars = string.gsub(" ", "").chars | |
# Increment the count the hash table for each character | |
chars.each do |char| | |
char_counts[char] += 1 |
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 first_nonrepeated_char( string ) | |
chars = string.gsub(" ", "").chars | |
chars.each_with_index do |ch, index| | |
# Skip characters that we have already marked as repeats. | |
next if ch.empty? | |
match = false | |
# Compare each character with the characters that follow it. |
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
# Define a method that takes a string | |
def first_nonrepeated_char( string ) | |
# Convert that string in to an Array of characters | |
chars = string.gsub(" ", "").chars | |
# Loop over the character Array, and compare | |
# each element to every other element | |
chars.each_with_index do |ch, index| | |
match = false |
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 floor_finder(input= "", floor = 0) | |
input.chars.each do |char| | |
if char == '(' | |
floor += 1 | |
elsif char == ')' | |
floor -= 1 | |
end | |
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
describe "floor_finder" do | |
it "starts Santa on the ground floor (floor 0)" do | |
expect(floor_finder).to eq 0 | |
end | |
it "moves up one floor for '('" do | |
expect(floor_finder('(')).to eq 1 | |
end |