Skip to content

Instantly share code, notes, and snippets.

@Eccenux
Eccenux / localStorageSize.js
Created April 1, 2016 14:06
localStorage size check (obviously it only works for current domain)
var keys = Object.keys(localStorage);
var total = 0;
for (var i in keys) {
var key = keys[i];
var size = localStorage[key].length;
console.log(key, ' size ', getReadableFileSizeString(size));
total += size;
}
console.log('\n-------\ntotal size ', getReadableFileSizeString(total));
@Eccenux
Eccenux / DataCache.js
Created April 1, 2016 13:28
Class providing caching for data objects (e.g. translations).
/**
* Class providing caching for data objects.
*
* It's assumed that the data comes from some remote service (otherwise there is no point in caching).
*
* @param {String} dataKey Globally(!) unique key to store data.
* @param {Storage} storageService Storage service that should have two functions:
* storageService.set(key, value) -- set data
* storageService.get(key) -- get data
* Will attempt fallback to `$.jStorage` if not secified.
@Eccenux
Eccenux / NuxPadder.js
Last active March 31, 2016 17:20
Pad left class :-]
/**
* Pad class.
*
* @author Maciej "Nux" Jaros
* @license CC-BY
*
* Note! The class becomes faster with new itterations.
*/
NuxPadder = function (character)
{
@Eccenux
Eccenux / iitc-plugin-keyhunt.user.js
Last active August 2, 2019 10:30
This is a uniques plugin fork which assists you in hunting keys from certain area. Effectively allows to tick a portal for which you have a key. Switch to "keyhunt" highlighter (included in this plugin) to show in red which keys you are still missing (in orange will be portals for which you haven't entered data yet). Use 'sync' plugin to share d…
// ==UserScript==
// @id iitc-plugin-keyhunt-keys@3ch01c
// @name IITC plugin: keyhunt-keys
// @category Misc
// @version 0.0.3.20160405.143600
// @namespace https://github.com/3ch01c/ingress-intel-total-conversion
// @description This is a plugin which assists you in hunting keys from certain area. Effectively allows to tick a portal for which you have a key. Switch to "keyhunt" highlighter (included in this plugin) to show in red which keys you are still missing (the portal for which you haven't entered data yet will be orange, other will be green). Use 'sync' plugin to share data between multiple browsers or desktop/mobile. Use keyhunt plugin with 'portals-list' plugin to quickly tick many portals on a list.
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
@Eccenux
Eccenux / .Ext.ux.grid.RestoreFilters.js
Last active August 22, 2016 11:15
ExtJS Restore filters grid plugin
/* global Ext */
/**
* Restore filters grid plugin.
*
* To use this plugin just add to your grid
* 1. `'Ext.ux.grid.RestoreFilters'` in `requires` property
* 2. `ptype: 'gridrestorefilters'` in `plugins` property
* 3. and `restoreableFilters` array as a setting for the plugin (see below)
*
@Eccenux
Eccenux / CascadeWindows.js
Last active February 2, 2016 19:32
Cascade window position plugin.
/* global Ext */
/**
* Cascade window position plugin.
*
* To use this plugin just add to your window
* 1. `'Ext.ux.CascadeWindows'` in `requires` property
* 2. `ptype: 'cascadewindows'` in `plugins` property
*
* @author Maciej "Nux" Jaros
@Eccenux
Eccenux / CB.openInBrowser.code.js
Created November 24, 2015 04:31
Custom Buttons (FF) - open URL from current tab in any browser
// IE
this.openCurrentUrl("c:\\Program Files\\Internet Explorer\\iexplore.exe");
// Firefox Developer Edition
this.openCurrentUrl("C:\\Program Files\\Mozilla\\Firefox Developer Edition\\firefox.exe");
// Chrome
this.openCurrentUrl("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe");
// Edge
// for whatever reason this doesn't work for local files (i.e. "file:///...")
this.openCurrentUrl("c:\\windows\\system32\\cmd.exe", ["/c", "start", "microsoft-edge:%u"]);
@Eccenux
Eccenux / CB.smartOpenWebPanel.code.js
Last active November 24, 2015 04:31
Custom Buttons (FF) - smartOpenWebPanel (replacement for openWebPanel)
this.smartOpenWebPanel("Translate", "https://translate.google.pl/");
@Eccenux
Eccenux / FramePostman.js
Last active October 13, 2015 21:39
Simple Frame Postman
/**
Simple Frame Postman
version 1.1.2
Author: Maciej "Nux" Jaros
License: CC-BY or MIT (at ones choosing)
Usage (simple setup):
@Eccenux
Eccenux / DefaultFilters.js
Last active December 9, 2015 11:17
Ext.ux.grid.DefaultFilters
/**
* Helps applying default filter values from grid to store.
*
* @example In your window with grid you could do:
* <pre>
initComponent: function() {
this.callParent();
// apply default filters from grid to store
var grid = this.down('grid');