Skip to content

Instantly share code, notes, and snippets.

View rosiehoyem's full-sized avatar

Rosie Hoyem rosiehoyem

View GitHub Profile
@rosiehoyem
rosiehoyem / apis
Last active August 29, 2015 14:09
API Best Practicies
#API Best Practices
##Routes
Restricting Routes
resources :zombies, only: [:index, :show]
resources :humans, except: [:destroy, :edit, :update]
##Subdomain
Keeping our API under its own subdomain allows load balancing traffic at the DNS level.
resources :zombies, constraints: { subdomain: 'api' }
resources :humans, constraints: { subdomain: 'api' }
@rosiehoyem
rosiehoyem / _.md
Created February 11, 2014 18:59
Solar Production Data
@rosiehoyem
rosiehoyem / testing.md
Last active December 26, 2015 18:58
Testing Articulated by an Energy Nerd

We started working with tests at the Flatiron School in week two. Every week tests have grown in complexity and we've encorporated new tools into our repetoir. We are now we're now in our 6th week and I decided it was time to break it down and do a full inventory of tools. This more for my own benefit than the world at large, but maybe others will find it useful also.

##What is testing? Software testing is an investigation conducted to provide stakeholders with information about the quality of the product or service under test. (Thanks Wikipedia). Even more than this simple definition, we do (Test Driven Development (TDD))[http://ruby.about.com/od/advancedruby/a/tdd.htm], which means we write our tests before we write out code, then write code to pass the tests. This, of course, mean that tests are very important to development to sucess of writing quality software. First, lets zoom way out to get some larger context from the industry (Rubiests didn't invent t

@rosiehoyem
rosiehoyem / blog-round-up-5.md
Last active December 26, 2015 03:39
Week 5 Blog Roundup

Anders What I Learned from Shipping my First Gem This past weekend Sonja and Charlotte and I shipped our first gem, so it was interesting to hear someone else's experience also. Anders created a simple weather gem to get a super basic weather report at the command line. Check it out: [Simple Forcast[(https://rubygems.org/gems/simple_forecast)

Another interesting bit that came from our disucssion was the immense utility of another gem, Chronic](http://chronic.rubyforge.org/)

Daniel Chang I had to include Daniel's post on Ruby Exceptions because these are things that have been confusing me as of lately. Not any more!

And a quick honable mention for Manley's post on Bash Shortcuts.

@rosiehoyem
rosiehoyem / blog-round-up.md
Last active December 26, 2015 00:09
Blog Post

#Week 4 Blog Round-up!

Here at the Flatiron School we are encouraged to actively blogged. We are also required to present one blog post every week or two to the group. So much interesting stuff has been coming from my classmates, I decided to do a weekly round-up of some of my favorite posts. Here are handful of interesting posts from the past week:

Charlote Chang In her post, Variable Scope: How I Learned to Stop Worrying and Love the Ruling Class, Charlotte dives into variable scope and the politics of health care. It's entertaining and informative not mention beautifully designed.

Trevor McKendrick 10 Ruby Tricks is nice list of new Ruby bits that I hope to incorporate into my coding immediately. How logical to set default attribute accessors with an attr_acce

class Plastic
def initialize
@plastic_bin = []
@plastic_types = ["num_1", "num_2", "num_3", "num_4", "num_5", "num_6", "num_7"]
end
def recycle_plastic(trash)
self.plastic_bin << trash if plastic_types.include?(trash)
end
end
@rosiehoyem
rosiehoyem / recycling.rb
Last active December 25, 2015 18:09
Refactoring Case Statements and Recycling
class Recycle
def initialize
@plastic_bin = []
@glass_bin = []
@paper_bin = []
@metal_bin = []
@landfill_bin = []
@plastic_types = ["num_1", "num_2", "num_3", "num_4", "num_5", "num_6", "num_7"]
@glass_types = ["clear", "color"]
@paper_types = ["paper", "cardboard"]
@rosiehoyem
rosiehoyem / serialize.rb
Created October 15, 2013 16:36
Serialize To Do
class Song
attr_accessor :title, :artist
def initialize
@artist = artist
end
def serialize
filename = self.title.downcase.gsub(' ','_')
text_to_write = "#{self.artist.name} - #{self.title}"
File.open("#{filename}.txt", 'w') { |file| file.write(text_to_write) }
@rosiehoyem
rosiehoyem / normalize_phone_numbers.rb
Created October 14, 2013 15:30
Normalize phone numbers TODO, day 5
def normalize_phone_number(phone)
if phone[/a-zA-Z/] == nil
phone.each_char do |x|
if !(x.match(/[\d]/))
phone.delete! x
end
end
phone.insert(0, "(")
phone.insert(4, ") ")
phone.insert(9, "-")
@rosiehoyem
rosiehoyem / pigeon_organizer.rb
Created October 14, 2013 15:28
Pigeon Organizer
########################
# NYC PIGEON ORGANIZER #
########################
pigeon_data = {
:color => {
:purple => ["Theo", "Peter Jr.", "Lucky"],
:grey => ["Theo", "Peter Jr.", "Ms .K"],
:white => ["Queenie", "Andrew", "Ms .K", "Alex"],
:brown => ["Queenie", "Alex"]