Created
June 5, 2012 09:18
-
-
Save matt-wratt/2873813 to your computer and use it in GitHub Desktop.
Testing JS Fiddle
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
p { | |
padding: 2px 5px; | |
} | |
p span { | |
color: red; | |
} |
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
<header> | |
Track My Fat | |
</header> | |
<nav> | |
<a href="#create">New weigh in</a> | |
<a href="#index">All weigh ins</a> | |
</nav> | |
<section id="page"></section> | |
<footer>Created by Matthew Wratt</footer> |
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
var Application = Backbone.Router.extend({ | |
routes: { | |
'': 'home', | |
'create': 'newWeighIn', | |
'index': 'allWeighIns' | |
}, | |
home: function() { | |
alert('home'); | |
}, | |
newWeighIn: function() { | |
alert('new weigh in'); | |
}, | |
allWeighIns: function() { | |
var weighIns = new app.collections.WeighIns(); | |
weighIns.fetch({url: '/gh/gist/response.json/2873813/'}); | |
app.weighIns = weighIns; | |
} | |
}); | |
var app = new Application(); | |
app.models = {}; | |
app.collections = {}; | |
app.views = {}; | |
app.models.Base = Backbone.Model.extend({}); | |
app.collections.Base = Backbone.Collection.extend({}); | |
app.views.Base = Backbone.View.extend({}); | |
app.models.WeighIn = app.models.Base.extend({}); | |
app.collections.WeighIns = app.collections.Base.extend({ | |
model: app.models.WeighIn | |
}); | |
$(function() { | |
Backbone.history.start(); | |
}); |
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
name: Test | |
description: jsFiddle test of using a github gist | |
authors: | |
- Matthew Wratt | |
resources: | |
- http://underscorejs.org/underscore.js | |
- http://backbonejs.org/backbone.js |
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
[{"id": 1, "date": "01/01/2012", "weight": 103.5},{"id": 2, "date": "02/01/2012", "weight": 103.4}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment