[ Launch: Green Button Data ] 8941619 by rosiehoyem
#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' } |
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
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.
#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 |
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"] |
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) } |
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, "-") |
######################## | |
# 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"] |