- Install VirtualBox https://www.virtualbox.org/
- Install Vagrant https://www.vagrantup.com/
- Install Git for Windows https://git-scm.com/download/win - this will also install MinGW shell
To run shell, press the Windows Key and run git bash
To run shell, press the Windows Key and run git bash
| fabric.Canvas.prototype.getItem = function(id) { | |
| var object = null, | |
| objects = this.getObjects(); | |
| for (var i = 0, len = this.size(); i < len; i++) { | |
| if (objects[i].id && objects[i].id === id) { | |
| object = objects[i]; | |
| break; | |
| } | |
| } |
| /** | |
| * Basic example to pass values between parent and child components in React | |
| * Seems to be in line with this | |
| * http://stackoverflow.com/questions/24147331/react-the-right-way-to-pass-form-element-state-to-sibling-parent-elements | |
| * Now I have the state in parent and child. Is that good or bad? Why would I need it in child? | |
| * Could probably take that out | |
| * */ | |
| class Parent extends React.Component { | |
| constructor(props) { | |
| super(props); |
| # lib/tasks/db.rake | |
| namespace :db do | |
| desc "Dumps the database to db/APP_NAME.dump" | |
| task :dump => :environment do | |
| cmd = nil | |
| with_config do |app, host, db, user| | |
| cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump" | |
| end | |
| puts cmd |
| # This is a skeleton for testing models including examples of validations, callbacks, | |
| # scopes, instance & class methods, associations, and more. | |
| # Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
| # | |
| # I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
| # so if you have any, please share! | |
| # | |
| # This skeleton also assumes you're using the following gems: | |
| # | |
| # rspec-rails: https://github.com/rspec/rspec-rails |
| !!! strict | |
| !!! XML | |
| %html | |
| -# Self closing tags | |
| %img{:src => "happy.jpg"}/ | |
| %div.myclass | |
| .myclass1 |
By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:
/people/6
But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.