Skip to content

Instantly share code, notes, and snippets.

View mdenisov's full-sized avatar

Maxim Denisov mdenisov

  • R1
  • Moscow, Russia
View GitHub Profile
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/service-worker.js');
}
const CACHE_PREFIX = 'Client';
const CACHE_VERSION = 'v1';
const CACHE_NAME = `${ CACHE_PREFIX }-${ CACHE_VERSION }`;
const CACHE_URLS = [
'/dist/offline.html',
'/dist/vendors.js',
app.filter('daterange', function() {
return function(items, startDate, endDate) {
var filteredResult = [];
// Parse from the filter format 'dd/mm/yyyy' (Turkish culture)
function parseDateFromFilter(strDate) {
var parts = strDate.split('/');
return new Date(parts[2], parts[1] - 1, parts[0]);
}
define([
'marionette',
'handlebars',
'modules/accountsData/views/pie',
'modules/accountsData/views/table',
'text!modules/accountsData/templates/wrapper.html',
],
function(Marionette, Handlebars, pie, table, tmpl) {
/*jshint browser:true */
/*global jQuery */
/*
jquery.scrollpane-startstop.js
Custom start and stop scrolling events for jScrollPane
https://gist.github.com/1963544
Usage:
/**
* localStorage with expire wrapper
*/
var myStorage = (function() {
var self = {};
/**
* Method unsets value in localStorage
*/
self.unset = function(key) {

#A simple Slideshow module wrapped in a Backbone View

  • Dependencies ** underscore.js ** backbone.js

Viewable in action in this jsfiddle

// browser history with HTML5 support
(function() {
var loc = window.location,
pushSupport = !!(window.history && window.history.pushState),
hashStrip = /^#*/;
// add HTML5 support to Backbone.history, drop the old IE stuff
_.extend(Backbone.History.prototype, {
getFragment : function(l) {
#
# Replaces Backbone.History with support for HTML5 history API if browser supports it.
# To use, setup your controllers as usual and try it with a browser that supports the HTML5 history API.
# For browsers that don't support the HTML5 API, this will fall back to using the default Backbone hash routing.
#
# I have only tested this on my project in Firefox, Safari and Chrome so let me know.
#
pushSupport = window.history? and window.history.pushState?
if pushSupport and Backbone? and Backbone.History?
rootUrl = document.location.protocol+'//'+(document.location.host or document.location.hostname)