Skip to content

Instantly share code, notes, and snippets.

View rolexta's full-sized avatar
💭
Baze Generator

Chandra Rolexta rolexta

💭
Baze Generator
  • suitmedia
  • Jakarta
View GitHub Profile
@shaik2many
shaik2many / javascript-localstorage-expiry.js
Created July 20, 2016 14:07
set timeout for localStorage or sessionStorage
http://apassant.net/2012/01/16/timeout-for-html5-localstorage/
var hours = 24; // Reset when storage is more than 24hours
var now = new Date().getTime();
var setupTime = localStorage.getItem('setupTime');
if (setupTime == null) {
localStorage.setItem('setupTime', now)
} else {
if(now-setupTime > hours*60*60*1000) {
localStorage.clear()
@olimortimer
olimortimer / gist:6775681
Created October 1, 2013 08:56
JS: Select2 FastClick Fix
$('#select2').select2({
data: data,
// Add our 'needsclick' to each item, so FastClick doesn't get applied
formatResult: function(result, container, query, escapeMarkup) {
container.addClass('needsclick');
return result.text;
}
});