diff --git a/backbone.md b/backbone.md
new file mode 100644
index 000000000..f6e17adf2
--- /dev/null
+++ b/backbone.md
@@ -0,0 +1,180 @@
+title: Backbone.js
+---
+
+### Binding events
+
+ .on('event', callback);
+ .on('event', callback, context);
+
+ .on({
+ 'event1': callback,
+ 'event2': callback
+ });
+
+ .on('all', callback);
+
+ .once('event', callback); /* Only happens once */
+
+### Unbinding events
+
+
+ object.off("change", onChange); // just the `onChange` callback
+ object.off("change"); // all "change" callbacks
+ object.off(null, onChange); // `onChange` callback for all events
+ object.off(null, null, context); // all callbacks for `context` all events
+ object.off(); // all
+
+### Events
+
+ object.trigger('event')
+
+ view.listenTo(object, event, callback)
+ view.stopListening()
+
+### List of events
+
+ * Collection:
+ * `add` (model, collection, options)
+ * `remove` (model, collection, options)
+ * `reset` (collection, options)
+ * `sort` (collection, options)
+
+ * Model:
+ * `change` (model, options)
+ * `change:[attr]` (model, value, options)
+ * `destroy` (model, collection, options)
+ * `error` (model, xhr, options)
+
+ * Model and collection:
+ * `request` (model, xhr, options)
+ * `sync` (model, resp, options)
+
+ * Router:
+ * `route:[name]` (params)
+ * `route` (router, route, params)
+
+### Views
+
+ // All attributes are optional
+ var View = Backbone.View.extend({
+ model: doc,
+
+ tagName: 'div',
+ className: 'document-item',
+ id: "document-" + doc.id,
+ attributes: { href: '#' },
+
+ el: 'body',
+
+ events: {
+ 'click button.save': 'save',
+ 'click .cancel': function() { ... },
+ 'click': 'onclick'
+ },
+
+ constructor: function() { ... },
+ render: function() { ... }
+ });
+
+ view = new View();
+ view = new View({ el: ... });
+
+ view.$el.show();
+ view.$("input");
+
+ view.remove();
+
+ view.delegateEvents();
+ view.undelegateEvents();
+
+### Model
+
+ // All attributes are optional
+ var Model = Backbone.Model.extend({
+ defaults: {
+ 'author': 'unknown'
+ },
+ idAttribute: '_id',
+ parse: function() {
+ }
+ });
+
+ var obj = new Model({ title: "Lolita", author: "Nabokov" });
+
+ var obj = new Model({ collection: ... });
+
+ obj.id
+ obj.cid //=> "c38" (client-side ID)
+
+ obj.clone()
+
+ obj.hasChanged('title')
+ obj.changedAttributes() /* false, or hash */
+ obj.previousAttributes() /* false, or hash */
+ obj.previous('title')
+
+ obj.isNew()
+
+ obj.set({ title: 'A Study in Pink' });
+ obj.set({ title: 'A Study in Pink' }, { validate: true, silent: true });
+ obj.unset('title')
+
+ obj.get('title')
+ obj.has('title')
+ obj.escape('title') /* Like .get() but HTML-escaped */
+
+ obj.clear()
+ obj.clear({ silent: true })
+
+ obj.save()
+ obj.save({ attributes })
+ obj.save(null, {
+ silent: true, patch: true, wait: true,
+ success: callback, error: callback
+ })
+
+ obj.destroy()
+ obj.destroy({
+ wait: true,
+ success: callback, error: callback
+ })
+
+ obj.toJSON()
+
+ obj.fetch()
+ obj.fetch({ success: callback, error: callback })
+
+### Model: validation
+
+ var Model = Backbone.Model.extend({
+ validate: function(attrs, options) {
+ if (attrs.end < attrs.start) {
+ return "Can't end before it starts";
+ }
+ }
+ });
+
+ obj.validationError //=> "Can't end before it starts"
+ obj.isValid()
+ obj.on('invalid', function(model, error) { ... })
+
+ // Triggered on:
+ obj.save()
+ obj.set({...}, { validate: true })
+
+### Model: custom URLs
+
+ var Model = Backbone.Model.extend({
+ // Single URL (string or function)
+ url: '/account',
+ url: function() { return '/account'; },
+
+ // Both of these two work the same way
+ url: function() { return '/books/' + this.id }),
+ urlRoot: '/books'
+ });
+
+ var obj = new Model({ url: ... });
+ var obj = new Model({ urlRoot: ... });
+
+
diff --git a/bash.md b/bash.md
index 331fbddb6..046387fe6 100644
--- a/bash.md
+++ b/bash.md
@@ -192,3 +192,4 @@ References
----------
* http://wiki.bash-hackers.org/
+* http://wiki.bash-hackers.org/syntax/shellvars
diff --git a/css.md b/css.md
index fa7b40f46..c84588bc9 100644
--- a/css.md
+++ b/css.md
@@ -94,6 +94,9 @@ Webkit extensions
### UIWebView optimizations
/* http://www.bitsandpix.com/entry/ios-webkit-uiwebview-remove-tapclick-highlightborder-with-css/ */
+ /*
+ http://www.yuiblog.com/blog/2010/10/01/quick-tip-customizing-the-mobile-safari-tap-highlight-color/
+ */
* {
-webkit-tap-highlight-color: rgba(0,0,0,0);
diff --git a/google_analytics.md b/google_analytics.md
new file mode 100644
index 000000000..2fbc164e1
--- /dev/null
+++ b/google_analytics.md
@@ -0,0 +1,19 @@
+title: Google Analytics
+----
+
+### Track events
+
+ // [..., category, action, label, value (int), noninteraction (bool)]
+ _gaq.push(['_trackEvent', 'Videos', 'Play', 'Birthday video', true])
+ _gaq.push(['_trackEvent', 'Projects', 'Donate', 'Project name'])
+ _gaq.push(['_trackEvent', 'Accounts', 'Login'])
+
+### Variables
+
+ // [..., index, name, value, scope (optional)]
+ _gaq.push(['_setCustomVar', 1, 'Logged in', 'Yes', 2]);
+
+ // Scope = 1 (visitor), 2 (session), 3 (page, default)
+
+https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingCustomVariables
+https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
diff --git a/html.md b/html.md
index 635bb9ce4..4a3faf815 100644
--- a/html.md
+++ b/html.md
@@ -78,7 +78,7 @@ Only do this if you're not placing the site in the root!
### Google jQuery
-
+
### Unsupported message
diff --git a/mocha.md b/mocha.md
new file mode 100644
index 000000000..816bf64bf
--- /dev/null
+++ b/mocha.md
@@ -0,0 +1,31 @@
+### BDD
+
+ mocha.setup('bdd');
+
+ describe('something', function() {
+ beforeEach(function() {
+ });
+
+ it('should work', function() {
+ });
+ });
+
+### Async
+
+ it('should save', function(done) {
+ var user = new User();
+ user.save(function(err) {
+ if (err) throw err;
+ done();
+ });
+ });
+
+### Chai: Shoulds
+
+ chai.should();
+
+ foo.should.be.a('string');
+ foo.should.equal('bar');
+ foo.should.have.length(3);
+ tea.should.have.property('flavors').with.length(3);
+
diff --git a/rails-helpers.md b/rails-helpers.md
index d45fbd31a..7377252df 100644
--- a/rails-helpers.md
+++ b/rails-helpers.md
@@ -43,6 +43,10 @@ http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html
time_tag Date.yesterday, 'Yesterday' #=>