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
// Creates a "Tweet" model based upon the Backbone.Model object | |
var Tweet = Backbone.Model; | |
// Instantiates the tweet model: | |
var myTweet = new Tweet({ | |
from_user : "natehunzaker", | |
text : "Grow you a #backbone for great good!" | |
}); |
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
// Creates a "Tweet" model based upon the Backbone.Model object | |
var Tweet = Backbone.Model.extend({ | |
defaults: { | |
from_user : "natehunzaker", | |
text : "Grow you a #backbone for great good!" | |
} | |
}); | |
// Instantiates the tweet model: | |
var myTweet = new Tweet(); |
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 Tweet = Backbone.Model; | |
var tweetsCollection = new Backbone.Collection({ | |
model: Tweet | |
}); | |
tweetsCollection.add({ | |
from_user : "natehunzaker", | |
text : "Grow your JS a #backbone for great good!" | |
}); |
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> | |
<head> | |
<meta charset="utf-8"> | |
<title>Twitter Map</title> | |
<link rel="stylesheet" href="css/style.css" /> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.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
// Twitter Map | |
$(function() { | |
//-- Data ---------------------------------------------------------------------// | |
var Tweet = Backbone.Model; | |
var Tweets = Backbone.Collection.extend({ | |
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() { | |
//... Model and Collection code ...// | |
//-- Views --------------------------------------------------------------------// | |
var Map = Backbone.View.extend({ | |
el: $('#map_canvas'), |
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 Tweet = Backbone.Model; | |
var tweetsCollection = new Backbone.Collection({ | |
model: Tweet, | |
initialize: function() { | |
this.bind('add', function(model) { | |
alert("Oh snap, we have a model!"); | |
}); |
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
# Note: | |
# Place this file within the config directory of your Rails 3.1 Application | |
########################################################################################## | |
# This configuration file works with both the Compass command line tool and within Rails. | |
# Require any additional compass plugins here. | |
project_type = :rails | |
# Set this to the root of your project when deployed: | |
http_path = "/" |
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() { | |
//... Mode, Collection, and View code ...// | |
//-- Initialize ---------------------------------------------------------------// | |
// Create an instance of the tweets collection | |
var tweets = new Tweets({ | |
model: Tweet |
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
;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Line Numbering | |
;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Note: I'm doing this in Emacs 24 on OSX | |
;; Swap line numbers using C-<f5>, you can change this of course | |
(autoload 'linum-mode "linum" "toggle line numbers on/off" t) | |
(global-set-key (kbd "C-<f5>") 'linum-mode) |
OlderNewer