austinmoore / ttalk-2009-06-18 Goto Github PK
View Code? Open in Web Editor NEWdemo app from the namics t.talk on Thursday, June 18th, 2009
demo app from the namics t.talk on Thursday, June 18th, 2009
# Preparation # Uninstall the will_paginate gem so that the audience can see what 'sudo rake gems:install' really does (this causes an error if the gem does not exist locally) sudo gem uninstall mislav-will_paginate # Ruby - Getting Started # I started with ruby by learning the Rails framework. I come from the java world. I can tell you the java equivalent for what I'm showing in ruby. # Any questions -> ask right away. # In the next 20 minutes we'll learn some ruby by... # creating a basic rails application # generating scaffold code # extend the generated code (with pagination) # if time remaining -> deploy the app live # If you want to get started with ruby/rails visit know.namics.com and type rails + windows for this tutorial # In terminal cd Desktop rails ttalk-app cd ttalk-app script/generate scaffold patient name:string surname:string birthday:date weight:integer rake db:migrate script/server # Open http://localhost:3000/patients # Create a new patient and edit it. View all patients. # Open directory in RubyMine # Show db/migrate/*_create_patients.rb # Rails is a MVC framework... # Show app/models/patient.rb # Show app/controllers/patients_controller.rb # Show app/views/patients/index.html.erb # Now we want to extend patients with pagination script/console Patient.create(:name => "Bob", :surname => "Barker", :birthday => 20.years.ago, :weight => 65) 20.times { Patient.create(:name => "Bob", :surname => "Barker", :birthday => 20.years.ago, :weight => 65) } # Refresh the page in browser. Now I have my patients. Let's add the pagination. # Won't do it by hand. That would be tiresome. # Switch to Browser -> Google "ruby toobox" -> Open ruby toolbox site # Navigate to "pagination" category # Open "will_paginate" page # Switch to RubyMine # add will_paginate gem to environment.rb config.gem 'mislav-will_paginate', :version => '~> 2.3.8', :lib => 'will_paginate', :source => 'http://gems.github.com' # Switch to Terminal gem list mislav # gem needs to be installed locally. Ask rails to install all of the gems the project needs. sudo rake gems:install # Now we have it gem list mislav # Switch to RubyMine -> patient.rb -> Change call to Patient.all to ... Patient.paginate :per_page => 5, :page => params[:page], :order => 'updated_at DESC' # Start up server in IDE # Switch to Browser and refresh -> Now only 5 patients are displayed # Now we need to update the view so we can navigate through the pages. # Switch to RubyMine -> index.html.erb -> Add pagination navigation <%= will_paginate @patients %> # Switch to Browser and refresh -> pagination navigation is displayed # By changing only 3 lines of code we have full functioning pagination. Wow. # Check time. If time remaining, show deployment to heroku # Switch to Terminal git init touch .gitignore touch .gems # Copy following to .gitignore .idea *.iml *.ipr *.iws .DS_Store log/*.log tmp/**/* config/database.yml db/*.sqlite3 db/schema.rb # Copy following to .gems mislav-will_paginate --version ">=2.3.8" --source "http://gems.github.com" # Switch to Terminal git add . git commit -m "initial commit" gem list hero heroku create austinttalk git push heroku master heroku rake db:migrate heroku console 20.times { Patient.create(:name => "Bob", :surname => "Barker", :birthday => 20.years.ago, :weight => 65) } # Switch to Browser -> http://austinttalk.heroku.com # Questions?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.