Skip to content

Instantly share code, notes, and snippets.

@kustomzone
kustomzone / background.js
Created November 27, 2018 06:48 — forked from danharper/background.js
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
### Keybase proof
I hereby claim:
* I am kustomzone on github.
* I am apps (https://keybase.io/apps) on keybase.
* I have a public key ASCXVOIzy4D7ijYm4BbYzVG6MT24twsXP2uHtTBuDVwCvwo
To claim this, I am signing this object:
@kustomzone
kustomzone / .block
Created April 11, 2017 13:48 — forked from mbostock/.block
GeoJSON in Three.js
license: gpl-3.0
height: 960
border: no
@kustomzone
kustomzone / specialChars.js
Last active March 17, 2017 15:50 — forked from alexgibson/specialChars.js
encode & decode special chars
//encodes special characters
function encodeString(str) {
return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#x27;').replace(/\//g, '&#x2F;').replace(/=/g, '&#x3D;');
}
//decodes special characters
function decodeString(str) {
return str.replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&#x27;/g, '\'').replace(/&#x2F;/g, '/').replace(/&#x3D;/g, '=');
}