Skip to content

Instantly share code, notes, and snippets.

View anextro's full-sized avatar

xcxcabczzzabczzz anextro

View GitHub Profile
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;
public class RedMart {
static class P{
@anextro
anextro / auth-route.js
Created September 18, 2015 19:27
Backbone Authentication Model and its usage by a subsystem to resolve a route
//actual auth.js
/**
* module name: auth
* role: It answers the query; Is the User Logged In
* @param url: Endpoint to make request
* @param state: The predicate
*/
module.exports = Backbone.Model.extend({
var RSVP = require('rsvp');
var jQuery = require('jquery');
// Log uncaught errors (important)
RSVP.on('error', function (reason) {
console.error((reason && reason.stack) || reason || 'Error');
});
// Shim the browser window with ES6 Promise
window.Promise = RSVP.Promise;
@anextro
anextro / all.js
Created September 16, 2015 22:07
A subapp/subsystem from the admin spa.
//Controller and how it handles any route
var Router = require('../routers/base_router.js');
var LoginView = require('../views/admin_login.js');
var ContentView = require('../views/admin_content.js');
var HeadView = require('../views/admin_header.js');
module.exports = Marionette.Object.extend({
rootview: null,
initialize: function(options){
this.router = new Router({controller:this});
@anextro
anextro / app.js
Created September 16, 2015 21:50
Excerpts from a Marionette Application
rootview: null,
initialize: function(){
//build rootivew and render empty content
this.rootview = new RootView().render();
this._setupManagers();
this.on("start", this._onStart);
},
_setupManagers: function(){