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
import $ from 'jquery'; | |
import Task from 'app/models/task'; | |
import TaskView from 'app/views/task_view'; | |
import TaskListView from 'app/views/task_list_view'; | |
import _ from 'underscore'; | |
var taskData = [ | |
{ | |
title: 'Mow the lawn', |
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
import $ from 'jquery'; | |
import Backbone from 'backbone'; | |
import _ from 'underscore'; | |
import Task from 'app/models/task'; | |
import TaskView from 'app/views/task_view'; | |
import TaskList from 'app/collections/task_list'; | |
var TaskListView = Backbone.View.extend({ | |
initialize: function(options) { |
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
// scrabble.js | |
import Backbone from 'backbone'; | |
// Create default Scrabble object | |
const Scrabble = Backbone.Model.extend({ | |
scoreLetter: function(letter) { | |
letter = letter.toUpperCase(); | |
var letters = ['A', 'E', 'I', 'O', 'U', 'L', 'N', 'R', 'S', 'T', 'D', 'G', 'B', 'C', 'M', 'P', 'F', 'H', 'V', 'W', 'Y', 'K', 'J', 'X', 'Q', 'Z']; | |
var scores = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 8, 8, 10, 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
// player.js | |
import Scrabble from 'scrabble'; | |
import Backbone from 'backbone'; | |
const Player = Backbone.Model.extend({ | |
defaults: { | |
}, | |
initialize: function(options) { | |
this.name = options.name; |
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
// spec/player_spec.js | |
import Player from 'player'; | |
describe('Player', function() { | |
var player; | |
beforeEach(function() { | |
player = new Player({ | |
name: "bob" |
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
# sample_code.rb from POOD Ch 3 | |
# Starter 1 - Heaviliy dependent Gear class | |
class Gear | |
attr_reader :chainring, :cog, :rim, :tire | |
def initialize(chainring, cog, rim, tire) | |
@chainring = chainring | |
@cog = cog | |
@rim = rim |
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
# Gems we've talked about in class, but which have absolutely nothing to do | |
# with setting up spec-style testing. | |
# Included here for convenience. | |
gem_group :development do | |
# Improve the error message you get in the browser | |
gem 'better_errors' | |
# Use pry for rails console | |
gem 'pry-rails' | |
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
// /src/app.js | |
// Import jQuery | |
import $ from 'jquery'; | |
import _ from 'underscore'; | |
import Task from './models/task'; | |
var my_task = new Task({ | |
title: "Create a model", | |
completed: true |
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
import Backbone from 'backbone'; | |
var Task = Backbone.Model.extend({ | |
defaults: { | |
title: '', | |
completed: false | |
}, | |
logStatus: function() { | |
console.log("Title: " + this.get("title")); | |
console.log("Completed: " + this.get("completed")); |
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
// /src/app.js | |
// Import jQuery | |
import $ from 'jquery'; | |
import _ from 'underscore'; | |
import Task from './models/task'; | |
import TaskList from './collections/task_list'; | |
var taskData = [{ | |
title: "Create a model", |
OlderNewer