View load-gist.js
url = 'https://gist.githubusercontent.com/ICEDLEE337/5db30bd28cc8ea2aefa974c5ef4b4400/raw/bba284eab353ab9a7ba5c58554db02730cada218/togglii.js'; | |
fetch(url) | |
.then(r => r.text()) | |
.then(inject); | |
function inject (text) { | |
var script = Object.assign(document.createElement('script'), {innerText: text}); | |
document.body.appendChild(script); | |
} |
View togglii.js
javascript: (() => { | |
var $http = $('body').injector().get('$http'); | |
var url = 'proxy/authpermissions-v2-server/toggles/'; | |
const GREEN = 'green'; | |
const RED = 'black'; | |
function render() { | |
const scrollPos = window.scrollY; | |
$http.get(url).then(res => res.data.toggles.sort((a, b) => sorter(a, b))).then(toggles => { | |
const ul = convertTogglesToUl(toggles); |
View lodash-throttle.js
(() => { | |
// in this example we invoke a fn for a period of 10 sec, invoking it 10 times a second, but we can perceive that the original function is only invoked at most once per second according to the parameter below | |
var TOTAL_TIME_TO_RUN = 10000; // 10 sec | |
var THROTTLE_INTERVAL = 2000; // <= adjust this number to see throttling in action | |
var INVOCATION_INTERVAL = 100; // 0.1 sec | |
// regular fn | |
var punchClock = function punchClock () { |
View .jshintrc
{ | |
"bitwise": false, | |
"curly": true, | |
"eqeqeq": true, | |
"es3": false, | |
"forin": true, | |
"freeze": true, | |
"immed": true, | |
"indent": 4, | |
"latedef": true, |