Skip to content

Instantly share code, notes, and snippets.

@hinc
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save hinc/79182c20cf3ec8cb782a to your computer and use it in GitHub Desktop.

Select an option

Save hinc/79182c20cf3ec8cb782a to your computer and use it in GitHub Desktop.

Revisions

  1. hinc revised this gist May 23, 2014. 2 changed files with 1 addition and 12 deletions.
    1 change: 1 addition & 0 deletions scrat-cache-bookmarklet.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    javascript:alert("Cached: "+Object.keys(localStorage).reduce(function(e,t){return~t.indexOf(require.options.prefix)?e+localStorage.getItem(t):e},"").length/1e3+"KB")
    12 changes: 0 additions & 12 deletions scrat-cache-size.js
    Original file line number Diff line number Diff line change
    @@ -1,12 +0,0 @@
    (function () {
    var l = [];
    Object.keys(localStorage).forEach(function (k) {
    if (~k.indexOf(require.options.prefix)) {
    l.push(localStorage.getItem(k));
    }
    });
    alert('Cached: ' + l.join('').length / 1000 + 'KB');
    })();

    // bookmarklet
    javascript:!function(){var e=[]Object.keys(localStorage).forEach(function(o){~o.indexOf(require.options.prefix)&&e.push(localStorage.getItem(o))}),alert("Cached: "+e.join("").length/1e3+"KB")}()
  2. hinc revised this gist May 23, 2014. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions scrat-cache-size.js
    Original file line number Diff line number Diff line change
    @@ -9,5 +9,4 @@
    })();

    // bookmarklet
    javascript:!function(){var e=[]
    Object.keys(localStorage).forEach(function(o){~o.indexOf(require.options.prefix)&&e.push(localStorage.getItem(o))}),alert("Cached: "+e.join("").length/1e3+"KB")}()
    javascript:!function(){var e=[]Object.keys(localStorage).forEach(function(o){~o.indexOf(require.options.prefix)&&e.push(localStorage.getItem(o))}),alert("Cached: "+e.join("").length/1e3+"KB")}()
  3. hinc renamed this gist May 23, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. hinc renamed this gist May 23, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. hinc created this gist May 23, 2014.
    13 changes: 13 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    (function () {
    var l = [];
    Object.keys(localStorage).forEach(function (k) {
    if (~k.indexOf(require.options.prefix)) {
    l.push(localStorage.getItem(k));
    }
    });
    alert('Cached: ' + l.join('').length / 1000 + 'KB');
    })();

    // bookmarklet
    javascript:!function(){var e=[]
    Object.keys(localStorage).forEach(function(o){~o.indexOf(require.options.prefix)&&e.push(localStorage.getItem(o))}),alert("Cached: "+e.join("").length/1e3+"KB")}()