Skip to content

Instantly share code, notes, and snippets.

View mdenisov's full-sized avatar

Maxim Denisov mdenisov

  • R1
  • Moscow, Russia
View GitHub Profile
// load-route-data.js
import { matchPath } from 'react-router-dom';
export default (dispatch, pathname, routes, query) => {
const promises = [];
routes.some(route => {
const match = matchPath(pathname, route);
@turhn
turhn / daterange_filter.js
Created August 19, 2014 16:02
Date range filter for Angular.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]);
}
@DzikuVx
DzikuVx / gist:5693478
Last active December 17, 2015 23:59
JavaScript Local Storage with item expire
/**
* localStorage with expire wrapper
*/
var myStorage = (function() {
var self = {};
/**
* Method unsets value in localStorage
*/
self.unset = function(key) {
define([
'marionette',
'handlebars',
'modules/accountsData/views/pie',
'modules/accountsData/views/table',
'text!modules/accountsData/templates/wrapper.html',
],
function(Marionette, Handlebars, pie, table, tmpl) {
@bryanchow
bryanchow / jquery.jscrollpane-startstop.js
Created March 3, 2012 01:54
Custom start and stop scrolling events for jQuery.jScrollPane
/*jshint browser:true */
/*global jQuery */
/*
jquery.scrollpane-startstop.js
Custom start and stop scrolling events for jScrollPane
https://gist.github.com/1963544
Usage:
@davemo
davemo / README.md
Created September 13, 2011 22:59
A simple Backbone.js powered Slideshow, with pause/play controls and jump-to controls.

#A simple Slideshow module wrapped in a Backbone View

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

Viewable in action in this jsfiddle

@mrjjwright
mrjjwright / backbone.history.html5.coffee
Created March 1, 2011 16:55
Add pretty html5 history support to Backbone
#
# 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)
@mataspetrikas
mataspetrikas / gist:811849
Created February 4, 2011 21:52
adding pushState support in BackBone.js (experimental)
// 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) {