Skip to content

Instantly share code, notes, and snippets.

View somebody32's full-sized avatar

Ilya Zayats somebody32

View GitHub Profile
@somebody32
somebody32 / app_finder.js
Created January 30, 2016 17:36
initial App Finder
import _ from 'underscore';
import Backbone from 'backbone';
// all the routes from the mini-apps
const custom_apps_routes = {
about: {
'about': 'about',
},
heavy: {
'heavy(/:heavy_param)': 'heavy',
@somebody32
somebody32 / router.diff
Last active February 5, 2016 17:38
trying to load app in router's 404 handler
import Backbone from 'backbone';
import $ from 'jquery';
+ import AppFinder from './app_finder';
export default Backbone.Router.extend({
routes: {
'': 'home',
'main_app_part': 'mainAppPart',
'*handleMissingRoute': 'handle404'
@somebody32
somebody32 / index.diff
Created January 30, 2016 15:36
Initial code splitting
import Backbone from 'backbone';
import $ from 'jquery';
import Router from './router';
- import AboutApp from './apps/about/';
- import HeavyApp from './apps/heavy/';
$(() => {
new Router();
- AboutApp();
@somebody32
somebody32 / router.diff
Last active January 28, 2016 20:07
router after extraction
import Backbone from 'backbone';
import $ from 'jquery';
export default Backbone.Router.extend({
routes: {
'': 'home',
'main_app_part': 'mainAppPart',
- 'about': 'about',
- 'heavy(/:heavy_param)': 'heavy',
'*handleMissingRoute': 'handle404',
@somebody32
somebody32 / index.diff
Last active February 6, 2016 20:16
importing apps in the index.js
import Backbone from 'backbone';
import $ from 'jquery';
import Router from './router';
+import AboutApp from './apps/about/';
+import HeavyApp from './apps/heavy/';
$(() => {
new Router();
+ AboutApp();
@somebody32
somebody32 / router.js
Created January 26, 2016 19:24
heavy's initial router
import Backbone from 'backbone';
import $ from 'jquery';
export default Backbone.Router.extend({
routes: {
'heavy(/:heavy_param)': 'heavy',
},
heavy(heavy_param) {
$('#app').html(`You're viewing that heavy app, heavy param from the URL is: ${heavy_param}`);
@somebody32
somebody32 / router.js
Last active January 26, 2016 19:24
about's initial router
import Backbone from 'backbone';
import $ from 'jquery';
export default Backbone.Router.extend({
routes: {
'about': 'about'
},
about() {
$('#app').html("You're viewing the about page. It is full of graphics");
@somebody32
somebody32 / index.js
Created January 26, 2016 19:17
./apps/index.js
import Router from './router';
export default () => {
new Router();
};
@somebody32
somebody32 / index.js
Last active January 30, 2016 15:20
index.js
import Backbone from 'backbone';
import $ from 'jquery';
import Router from './router';
$(() => {
new Router();
Backbone.history.start();
});
@somebody32
somebody32 / router.js
Last active January 26, 2016 19:21
Initial Router
import Backbone from 'backbone';
import $ from 'jquery';
export default Backbone.Router.extend({
routes: {
'': 'home',
'main_app_part': 'mainAppPart',
'about': 'about',
'heavy(/:heavy_param)': 'heavy',
'*handleMissingRoute': 'handle404',