- Filenames must be all-lowercase and cannot contain any spaces, ever.
- Always save your code files before refreshing your browser. Otherwise your code will not take effect.
- All code repositories must be placed directly under your
code
folder. - Never put one code repository inside of another. Each repository must be one level down inside the
code
folder. - Use lowercase for all code (HTML tags, CSS rules, Javascript, Ruby, etc.) unless specificially instructed otherwise.
- View the Source, Luke!
- Use the Web Inspector, Luke!
- Coding is deterministic. There is a cause for every effect. Allow nothing to remain "magical" or "fuzzy".
- You should be able to verbally explain your app's behavior when called upon.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this file to your config/initializers directory. | |
# | |
# Then you can do things like: | |
# | |
# Product[5] instead of Product.find_by(id: 5) | |
# Product.sample to pull a random Product row | |
# Product.sample(3) to pull three random Product rows (but they will be consecutive) | |
# | |
# Biggest part: automatic associations! | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Product | |
attr_accessor :title | |
attr_accessor :image_url | |
attr_accessor :url | |
def initialize(title, image_slug, asin) | |
@title = title | |
@url = "http://www.amazon.com/dp/#{asin}" | |
@image_url = "http://ecx.images-amazon.com/images/I/#{image_slug}._SL1500_.jpg" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def sort(items): | |
for position in range(0, len(items)): | |
min_position_so_far = position | |
for z in range(position+1, len(items)): | |
if items[z] < items[min_position_so_far]: | |
min_position_so_far = z |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"match_selection": false, | |
"remember_open_files": false, | |
"save_on_focus_lost": true, | |
"tab_size": 2, | |
"translate_tabs_to_spaces": true, | |
"trim_trailing_white_space_on_save": true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> | |
<script src="http://code.jquery.com/jquery-2.1.4.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python 3.4 | |
# A nice class | |
class Person: | |
def __init__(self, name): | |
self.name = name | |
# A nice function | |
def speak(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# you'd obviously have more settings somewhere | |
set :scm, :git | |
set :repository, "[email protected]:defunkt/github.git" | |
set :branch, "origin/master" | |
set :migrate_target, :current # this tells capistrano where to run the migration. otherwise it would try to use the latest release directory (/path/to/app/releases/2012XXXXXXXXX) | |
set :use_sudo, false | |
set :ssh_options, {:forward_agent => true} # so you can checkout the git repo without giving the server access to the repo | |
set :rails_env, 'production' | |
# These are here to override the defaults by cap |
A user's true identity or email address must be verified before they are given full access to your application.
The system sends an email to the user's email address containing a unique, personalized url. Visiting the url in a browser provides sufficient identity verification, since the url could only have been known to the person who received the email.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Given these models: | |
# | |
# Customer | |
# - name: string | |
# | |
# Product | |
# - price: integer | |
# | |
# Order | |
# - customer_id: integer |