This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| require 'csv' | |
| require "pry" | |
| require "./attendee" | |
| class DataSet | |
| attr_reader :storage, :attendees | |
| def initialize(file = "event_attendees.csv") | |
| @file = file | |
| @storage = [] | |
| end |
| require "pry" | |
| class Attendee | |
| attr_accessor :first_name, :last_name, | |
| :zipcode, :city, | |
| :email_address, :state, | |
| :street, :homephone, | |
| :regdate, :row | |
| def initialize(row) | |
| @first_name = row[:first_name] |
| require "pry" | |
| class EventReporter | |
| def initialize | |
| @queue = [] | |
| end | |
| def run | |
| input = '' |
| def create | |
| @user = User.new(user_params) | |
| if @user.save && current_order.id | |
| session[:user_id] = @user.id | |
| current_order.update_attributes(:user_id => @user.id) # new line | |
| current_order.save | |
| redirect_to order_path(current_order.id), :notice => "Signed up!" | |
| elsif @user.save && !current_order.id | |
| session[:user_id] = @user.id | |
| redirect_to menu_path |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| begin | |
| require 'bundler/inline' | |
| rescue LoadError => e | |
| $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
| raise e | |
| end | |
| gemfile(true) do | |
| source 'https://rubygems.org' | |
| gem 'rails', path: '~/programming/projects/rails', branch: '4-2-stable' |
| /// Find all prime numbers less than `n`. | |
| /// For example, `sieve(7)` should return `[2, 3, 5]` | |
| pub fn sieve(n: usize) -> Vec<usize> { | |
| let mut p:usize = 2; | |
| let range = p..n; | |
| let mut list:Vec<usize> = vec![]; | |
| //build list | |
| for x in range { | |
| list.push(x); |
Getting started:
Related tutorials:
| # app/models/user.rb | |
| class User < ActiveRecord::Base | |
| validates :zip_code, presence: true, zip_code: true | |
| end |
| [File System] 2016/07/14 21:41:44 DEBUG - Copying dir '/Users/Adam/.bosh_init/installations/924920ae-200f-404a-7704-9ac3c6cf284e/tmp/rendered-jobs553169157' to '/Users/Adam/.bosh_init/installations/924920ae-200f-404a-7704-9ac3c6cf284e/tmp/rendered-job-list-archive177362242/nats' | |
| [File System] 2016/07/14 21:41:44 DEBUG - Copying dir '/Users/Adam/.bosh_init/installations/924920ae-200f-404a-7704-9ac3c6cf284e/tmp/rendered-jobs553169157/bin' to '/Users/Adam/.bosh_init/installations/924920ae-200f-404a-7704-9ac3c6cf284e/tmp/rendered-job-list-archive177362242/nats/bin' | |
| [File System] 2016/07/14 21:41:44 DEBUG - Copying file '/Users/Adam/.bosh_init/installations/924920ae-200f-404a-7704-9ac3c6cf284e/tmp/rendered-jobs553169157/bin/nats_ctl' to '/Users/Adam/.bosh_init/installations/924920ae-200f-404a-7704-9ac3c6cf284e/tmp/rendered-job-list-archive177362242/nats/bin/nats_ctl' | |
| [File System] 2016/07/14 21:41:44 DEBUG - Copying dir '/Users/Adam/.bosh_init/installations/924920ae-200f-404a-7704-9ac3c6cf284e/tmp/rendered-jobs553 |