Skip to content

Instantly share code, notes, and snippets.

@marvi
Created December 17, 2012 10:42
Show Gist options
  • Select an option

  • Save marvi/4317355 to your computer and use it in GitHub Desktop.

Select an option

Save marvi/4317355 to your computer and use it in GitHub Desktop.

Revisions

  1. marvi created this gist Dec 17, 2012.
    32 changes: 32 additions & 0 deletions gistfile1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    _.templateSettings = {
    interpolate: /\{\{=(.+?)\}\}/g,
    evaluate: /\{\{(.+?)\}\}/g
    };

    // We begin by creating a namespace `xx`. Choose the name you want.
    var App = {};

    // Then the view namespace.
    // We will put class (starting with an upper case),
    // and instances (starting with a lower case) shared in the whole application
    App.views = {};

    // Then the model namespace.
    // A collection share the Model name but end with a `s` (the plural of the Model).
    // For exemple:
    //
    // * Model: Todo
    // * Collection: Todos
    //
    // Class and instances(global in the whole application) will be present under this namespace.
    App.models = {};

    // Put under this namespace home made utils functions.
    App.util = {};

    // Event aggregator
    App.vent = _.extend({}, Backbone.Events);

    $(function() {
    App.router = new App.Router();
    });