Resources for the TIY-Durham Rails course.
Students should be comfortable with the following at the end of this week:
Challenge: Javascript (in Tabula Railsa)
pluckpluck in select_tags<%= f.select :teacher_id, Teacher.all.map {|t| [t.name , t.id]} %><%= f.collection_select :teacher_id, Teacher.all, :id, :name %>rails g mailer MailerNameMailer action_name other_action_nameenvironments/development.rb per http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration-for-gmailMailerNameMailer.other_action_name.deliver_now.deliver_laterChallenge: Double Loop Challenge
form_tag html: { multipart: true } do |f|file_field_tag :uploaded_filegem "paperclip", "~> 4.2"add_attachment :table, :uploaded_filehas_attached_file :uploaded_filevalidates_attachment_content_type :uploaded_file, :content_type => /\Atext\/.*\Z/form_for @object, html: { multipart: true } do |f|f.file_field :uploaded_filegem 'aws-sdk', '~> 1.6'Code for config/application.rb:
config.paperclip_defaults = {
:storage => :s3,
:url =>':s3_domain_url',
:path => '/:class/:attachment/:id_partition/:style/:filename',
:s3_credentials => {
:bucket => ENV['S3_BUCKET_NAME'],
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
}
Exercise 1: Graph deaths.csv on an HTML page. Use CSS as you see fit, but don’t use any graphing libraries which you may have learned.
part1 branch)circle (cx, cy, r)line (x1, y1, x2, y2)rect (x, y, width, height)g (and transform="translate(100,100) rotate(0)")d3.select()d3.selectAll()d3.select(element)my_selection.select()my_selection.append("circle")my_selection.attr("cx", 200), etcmy_selection.style("fill", "red")my_selection.remove()d3.scale.linear()my_scale.domain([lowest_input, highest_input])my_scale.range([output_for_lowest, output_for_highest])d3.svg.axis().scale(my_scale).orient("left").ticks(count) (or "top", "bottom", or "right")selection.call(my_axis).tickFormat(d3.format("d"))Exercise 2: Start from the part2 branch. Graph points on an x/y plane. Open old_discoveries.csv and use its “year” column as X and its “important_discoveries” column as Y.
d3.json/csv/xml/html/tsv/textd3.json("file.json", function(data) {...})ruby -run -ehttpd . -p8000python -m SimpleHTTPServer 8000 (Python 2) or python -m http.server 8000 (Python 3)npm install -g node-static then static -p 8000selection.data(data)data_join.attr("r", function(data_point) {})data_join.attr("r", function(data_point, index) {})data_join.on("click", function(data_point, index) {…})data_join.enter()data_join.exit()Exercise 3: Add a dropdown to the page which will let you change the Y value of each year to a different column of data.csv. Start from the part3 branch.
my_scale.interpolate(d3.interpolateHcl)selection.transition()my_transition.duration(zoomTime)Begin Ruby Koans.
Continue work on Ruby Koans. Then practice any of the concepts from class that you think will be helpful during your final projects.
Pitch Day!