Skip to content

Instantly share code, notes, and snippets.

View dgreenbe77's full-sized avatar

Daniel Greenberg dgreenbe77

  • Hirefrederick, Inc.
  • San Francisco, CA
View GitHub Profile
export BUNDLER_EDITOR='/Applications/RubyMine.app/Contents/MacOS/rubymine'
defaults write NSGlobalDomain KeyRepeat -int 0
RUBYMINE_VM_OPTIONS="/Users/dgreenbe77/.rubymine_vm_options"
#ALIASES YO
#Files
alias zsh="vim ~/.zshrc"
@dgreenbe77
dgreenbe77 / gist:9197795
Last active August 29, 2015 13:56
Cash Register 3
require 'pry'
require 'csv'
def get_item_information
hash_array = []
CSV.foreach('products.csv', headers: true) do |row|
hash_array << row.to_hash
end
return hash_array
end
require 'pry'
require 'csv'
def get_item_information
hash_array = []
CSV.foreach('products.csv', headers: true) do |row|
hash_array << row.to_hash
end
return hash_array
end
@dgreenbe77
dgreenbe77 / gist:9149996
Created February 22, 2014 07:17
Hangman
require 'pry'
dictionary = File.open('dictionary.txt')
dictionary_array = dictionary.readlines
dictionary_array.shuffle!
counter = 7
word = dictionary_array.pop.split(//).delete_if { |letter| letter == "\n" }.join
split_word = word.split(//)
split_word_copy = word.split(//)
@dgreenbe77
dgreenbe77 / gist:9149957
Last active August 29, 2015 13:56
List_Stasts
require 'pry'
def sort_from_biggest_to_smallest(sorted_statistics, unsorted_statistics)
unsorted = unsorted_statistics
popped_number = unsorted_statistics.pop
sorted = sorted_statistics
remaining_unsorted_objects = []
if unsorted.empty?
return sorted
@dgreenbe77
dgreenbe77 / gist:9140640
Created February 21, 2014 18:46
Movies Hash
favorite_movies = [
{ title: 'The Big Lebowski', year_released: 1998, director: 'Joel Coen', imdb_rating: 8.2 },
{ title: 'The Shining', year_released: 1980, director: 'Stanley Kubrick', imdb_rating: 8.5 },
{ title: 'Troll 2', year_released: 1990, directory: 'Claudio Fragasso', imdb_rating: 2.5 }
]
favorite_movies.each do |movie|
puts "#{movie[:year_released]}: #{movie[:title]}"
end
@dgreenbe77
dgreenbe77 / gist:9136039
Created February 21, 2014 15:17
Game of Thrones Hash
characters = {
"Tyrion Lannister" => "House Lannister",
"Jon Snow" => "Night's Watch",
"Hodor" => "House Stark",
"Stannis Baratheon" => "House Baratheon",
"Theon Greyjoy" => "House Greyjoy"
}
puts "Enter character name:"
character_name = gets.chomp
@dgreenbe77
dgreenbe77 / gist:9135588
Created February 21, 2014 14:52
Shopping List Log
commit fda290c9c66e54b7ef9ea827342ade43b05dabef
Author: Eric Kelly <[email protected]>
Date: Mon Apr 29 06:21:42 2013 -0400
Update readme description & formatting instructions
commit a33a560fcae8f70adb768d5e662e2b3c1714ed11
Merge: 2ed573b 37f75d5
Author: Eric Kelly <[email protected]>
Date: Mon Apr 29 01:45:45 2013 -0700
@dgreenbe77
dgreenbe77 / gist:9103432
Created February 19, 2014 22:57
Crazy_Arrayz_Solution
require 'pry'
#Command line: Prompt user to input one teammember name at a time, until they are done.
def input_name
print "Enter a name. Type 'done' when finished. "
name= gets.chomp
if !/[a-zA-Z]/.match(name)
puts "Invalid"
name = input_name
@dgreenbe77
dgreenbe77 / gist:9099942
Created February 19, 2014 19:40
Crazy_Arrayz_Arrayz
require 'pry'
#Command line: Prompt user to input one teammember name at a time, until they are done.
name_array = []
loop do
print "Enter a name. Type 'done' when finished. "
name = gets.chomp
break if name=='done'
name_array << name