Skip to content

Instantly share code, notes, and snippets.

View edenthecat's full-sized avatar

Eden Rohatensky edenthecat

View GitHub Profile
{
"font": {
"typography": {
"h1": {
"description": "Largest text on the screen, reserved for short high emphasis text or numerals.",
"type": "custom-fontStyle",
"value": {
"fontSize": 40,
"textDecoration": "none",
"fontFamily": "Noto Sans",
@edenthecat
edenthecat / holler.md
Last active February 9, 2018 18:05
Alert me when a process is complete

Install terminal-notifier via homebrew: https://github.com/julienXX/terminal-notifier

If using zsh, create an alias: alias -g holler="echo 'holler' | terminal-notifier -sound default"

Store it in ./zshrc if you're happy with it!

Now you can run bundle exec rspec ; holler and it will make a notification that says "holler" when your tests are done.

def findHighestProduct(list_of_ints)
for i in 0...list_of_ints.length
list_of_ints[i] = list_of_ints[i].abs
end
puts list_of_ints.to_s
list_of_ints.sort!.reverse!
max_product = list_of_ints[0] * list_of_ints[1] * list_of_ints[2]
def getProductsOfAllIntsExceptAtIndex(someIntegers)
products = []
for i in 0...someIntegers.length
integersWithoutIndex = someIntegers.dup
integersWithoutIndex.delete_at(i)
product = 1
for j in integersWithoutIndex
product *= j
end
def getMaxProfit(stock_prices_yesterday)
if stock_prices_yesterday.index(stock_prices_yesterday.min) < stock_prices_yesterday.index(stock_prices_yesterday.max)
max_profit = (stock_prices_yesterday.max - stock_prices_yesterday.min)
else
possible_profits = []
minIndex = 0
maxIndex = stock_prices_yesterday.length
stock_prices_yesterday[0...(maxIndex-1)].each do |i|
@edenthecat
edenthecat / findFifthLargest.rb
Created December 9, 2015 18:36
Ruby: Find the Fifth Largest Integer in an Array of Unsorted Integers
def findFifthLargest
someIntegers = [1, 7, 4, 506, 3, 9, 10, 33]
sortedIntegers = someIntegers.sort.reverse!
puts sortedIntegers[4]
end
findFifthLargest
@edenthecat
edenthecat / filterString.rb
Created December 9, 2015 18:28
Ruby: Remove Filtered Characters from a String
def filterString
originalString = "Hello this is dog"
filter = "Hdgol"
puts "the original string is " + originalString
puts "filter: " + filter
splitString = originalString.split(//)
splitFilter = filter.downcase.split(//)