Skip to content

Instantly share code, notes, and snippets.

View blake41's full-sized avatar

Blake Johnson blake41

  • http://blakejohnson.brandyourself.com/
View GitHub Profile
require 'pry'
require 'pry-nav'
array = ["1-28-2015 NYC LPEP $20.16",
"1-29-2015 DEN $17.06",
"1-30-2015 Aden Food Market $11.89",
"1-30-2015 ZIZI LIMONA $96.65",
"1-31-2015 FOODTOWN $67.49",
"2-4-2015 NYC-TAXI $15.96",
"2-4-2015 DRAM $21.00",
"2-4-2015 BALTHAZAR $42.40",
relationships = []
File.foreach("./input.txt") do |line|
items = line.split(" ")
relationships << [items[6], items[7]]
end
connections = Hash.new {|k, v| k[v] = []}
relationships.each do |pair|
connections[pair[0]] << pair[1]
end
Function.prototype.bind = function(that) {
var args = Array.prototype.slice.call(arguments)
return function() {
this.call(that, args)
}
}
var myobj = {
name : "blake",
Guys I made an app this morning but I can't get it to work! Please help me debug.
The problem is that I can go to the new action and hit the submit button, and it seems like it creates the game
but it seems like it's saving blank names for the games name. If I go to the index I just see a list of blanks?
https://github.com/blake41/debug
Once you figure out what I screwed up please write a blog post about how you debugged it. Write out every step that happens between clicking submit on the form and what I expected to happen, and the trail of breadcrumbs you went through to help me.
Two options for this afternoon
Work by yourself or in any pair you'd like.
https://gist.github.com/blake41/8317538
or, i'm going to do a lecture/code along that will be beginner speed focused on the same topic.
Railscasts
There is a paid version of railscasts which includes some extra episodes. I think this is a bit of a hack to be able to download those. Ryan Bates is awesome, so when you get some money, pay him for these. These are really the best rails resources on the planet.
Draw how associations fit into a web application. How do they affect the model, the view and the controller. See if you can articulate/visualize the pieces that now need to fit together. As yesterday please take a pic/scan and post.
You should know what an association is from section 2.33 of the homework last night
2.3.3 A user has_many microposts
One of the most powerful features of Rails is the ability to form associations between different data models. In the case of our User model, each user potentially has many microposts. We can express this in code by updating the User and Micropost models as in Listing 2.10 and Listing 2.11.
Draw all the pieces of a rails app, how they interact and how you imagine the order of things happening. Make sure you cover all the pieces it takes to create one resource in rails that can be created, read, updated and destroyed. Take a pic and post a link to it or use the scanner.
HOLIDAY ACTIVITIES
-----
READING
Want to get better at writing "good" Ruby?
Read refactoring in Ruby
https://dl.dropboxusercontent.com/u/39011/refactoring_in_ruby.zip
RESTful Rabbits
http://ididitmyway.herokuapp.com/past/2010/9/21/restful_rabbits/
this is an exercise that teaches you about a convention of organizing your routes and your data called REST.
this uses a third ORM called Datamapper.
do this exercise as written with Datamapper.
then translate it to Sequel. then Activerecord. you will have 3 different apps. feel free to change up the animal if you want.
create a sinatra application called "is it my birthday yet". it should have a single route that displays the word "yes" or "no" depending whether or not it is that day.
EXTENSION:
make a route that takes a parameter(the name of a holiday or event), and returns a single view that will display yes or no is it is that day.