This file contains 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
GET /users/1.json HTTP/1.1 | |
This file contains 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
get '/' do | |
# @visitor_name = params[:name] | |
erb :index | |
end | |
get '/challenges' do | |
# go to database and get challenges | |
# challenges = Challenge.all.order('progress DESC').to_json | |
challenges = [{ | |
id: 1, |
This file contains 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
//function example() { | |
// console.log(arguments); | |
//} | |
// | |
//example('hi', 'my', 'name', 'is'); | |
function mixin() { | |
var dest = {}; | |
//var sources = Array.prototype.slice.call(arguments, 0); // Not necessary anymore |
This file contains 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 Bee < ActiveRecord::Base | |
belongs_to :hive | |
end |
This file contains 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
# Homepage (Root path) | |
get '/' do | |
@visitor_name = params[:name] | |
erb :index | |
end | |
get '/users' do | |
# @users = User.all | |
@users = [{ | |
username: 'Big Bill', |
This file contains 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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<link rel="stylesheet" href="bower_components/jquery-ui/themes/smoothness/jquery-ui.css"/> | |
</head> | |
<body> | |
<input id="city-input" placeholder="type yo city"/> | |
<script src="bower_components/jquery/dist/jquery.js"></script> |
This file contains 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 StaticClass | |
def self.do_thing | |
puts "I'm doing a thing" | |
end | |
def initialize | |
raise 'You cannot instantiate me!' | |
end |
This file contains 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
david:~ david$ node | |
> charlie; | |
ReferenceError: charlie is not defined | |
at repl:1:1 | |
at REPLServer.defaultEval (repl.js:132:27) | |
at bound (domain.js:254:14) | |
at REPLServer.runBound [as eval] (domain.js:267:12) | |
at REPLServer.<anonymous> (repl.js:279:12) | |
at REPLServer.emit (events.js:107:17) | |
at REPLServer.Interface._onLine (readline.js:214:10) |
This file contains 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
if Rails.env.development? | |
users = [] | |
posts = [] | |
comments = [] | |
500.times do |i| | |
users << User.create(name: Faker::Name.name) | |
end |
This file contains 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
# REST Resources | |
## Articles Resrouce | |
GET http://example.com/articles | |
- Gets all the articles (probably HTML) | |
POST http://example.com/articles | |
- Creates a new article (the article that was created, e.g. articles/100) | |
GET http://example.com/articles/99 | |
- Gets article 99 (probably HTML) |