require 'digest/md5' class List < ActiveRecord::Base
has_many :entries, -> { order('position asc') }, dependent: :destroy has_many :songs, through: :entries belongs_to :user
before_create :create_slug
validates_uniqueness_of :sharing_slug
require 'digest/md5' class List < ActiveRecord::Base
has_many :entries, -> { order('position asc') }, dependent: :destroy has_many :songs, through: :entries belongs_to :user
before_create :create_slug
validates_uniqueness_of :sharing_slug
Rails began life aimed at professional developers, but now I'm using it to revolutionize the way kids and adults learn computer programming. Building an app enables non-programmers to step into computer science without the boring theory and math-like courses that have been traditionally used. I'll show the curriculum I'm using at schools like NU and UChicago, in which students pick up basic CS concepts and more, like design patterns, agile principles, critical thinking skills, and teamwork.
I think many developers don't know the wealth of computer science literacy that's gained when new programmers learn Rails for the first time. Students think they're building a fun app, but I use it to introduce fundamental CS concepts along the way. It's been a wonderful way for students to learn CS basics in a manner completely anti-thetical to the standard CS curriculum used across the nation.
Imagine you are born into a society in which you can read as many books as you like, but you aren't allowed to write any of your own. Instead, only Official Book Writers are allowed to write books.
Then you find out that you are allowed to join the Official Book Writers Society, but you first have to write your book with one of the Official Pens. You can obtain an Official Pen fairly easily (they're free), but writing with one turns out to be nearly impossible. It doesn't look like any pen you've ever tried before, and knowing how to use it seems like a secret art.
Your friends tell you about some YouTube videos that try to teach newbies how to write with an Official Pen. Turns out the first thing you have to learn in order to write with an Official Pen is how to self-install a new electrical system in your house.
You're not sure why you need a new electrical system just to use a P
# Ruby Vitamin Check-Up | |
# | |
# (Google for "ruby array") | |
building_ages = [15, 56, 71, 32, 42, 46, 63, 91, 102] | |
# 1. How old is the oldest building? | |
# 2. What's the average age of these buildings? |
<!doctype html> | |
<html lang="en"> | |
<head> | |
<title>My Page</title> | |
<meta name="viewport" content="width=device-width"> | |
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css"> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> | |
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script> |
class HockeyTeam | |
attr_accessor :wins, :reg_losses, :ot_losses | |
end | |
chicago = HockeyTeam.new | |
chicago.wins = 9 | |
chicago.reg_losses = 2 | |
chicago.ot_losses = 4 |
'' == '0' | |
0 == '' | |
0 == '0' | |
false == 'false' | |
false == '0' | |
false == undefined | |
false == null | |
null == undefined |
https://gist.github.com/JeffCohen/43717a0b1dcc4bbe55f4 |