Skip to content

Instantly share code, notes, and snippets.

View JeffCohen's full-sized avatar

Jeff Cohen JeffCohen

View GitHub Profile

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

How Rails is Revolutionizing Our Schools

Abstract

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.

For The Review Committee

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.

@JeffCohen
JeffCohen / maybe.md
Last active August 29, 2015 13:56
Maybe

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

@JeffCohen
JeffCohen / ez.md
Last active August 29, 2015 13:56
The ez gem

The EZ gem

The ez gem is intended to help non-programmers during their first few weeks of learning Rails.

Currently only the happiest of all paths have been tested, and as far as I know, it only works on my machine.

  # Add it to your Gemfile
  
 gem 'ez', group: 'development'
@JeffCohen
JeffCohen / vitamins.rb
Created February 19, 2014 18:51
Ruby Vitamin Check-Up
# 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?
@JeffCohen
JeffCohen / deployment.md
Last active August 29, 2015 13:56
Deployment Checklist

Checklist for First-Time Deployment on VPS

One-Time: Local

  1. Gemfile: mysql2
  2. exception notification
  3. env var for rails secret token
  4. seeds file
  5. green tests
@JeffCohen
JeffCohen / index.html
Created November 9, 2013 20:24
Testing navbar padding
<!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>
@JeffCohen
JeffCohen / hockey_team.rb
Last active December 27, 2015 08:29
Hockey Team
class HockeyTeam
attr_accessor :wins, :reg_losses, :ot_losses
end
chicago = HockeyTeam.new
chicago.wins = 9
chicago.reg_losses = 2
chicago.ot_losses = 4
@JeffCohen
JeffCohen / craziness.js
Last active December 21, 2015 03:19
Javascript equality operators
'' == '0'
0 == ''
0 == '0'
false == 'false'
false == '0'
false == undefined
false == null
null == undefined
@JeffCohen
JeffCohen / gist:6056054
Created July 22, 2013 18:00
Profile URL
https://gist.github.com/JeffCohen/43717a0b1dcc4bbe55f4