This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(global){ | |
function generateJsonpCallback() { | |
return `jsonpcallback_${Date.now()}_${Math.floor(Math.random() * 100000)}`; | |
} | |
function removeScript(id) { | |
document.body.removeChild(document.getElementById(id)); | |
} | |
function removeFunc(name) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(root){ | |
var modMap = {}; | |
var moduleMap = {}; | |
var cfg = { | |
baseUrl: location.href.replace(/(\/)[^\/]+$/g, function(s, s1){ | |
return s1 | |
}), | |
path: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(doc, win) { | |
var docEl = doc.documentElement, | |
resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize', | |
recalc = function() { | |
var clientWidth = docEl.clientWidth; | |
if (!clientWidth) return; | |
docEl.style.fontSize = 20 * (clientWidth / 320) + 'px'; | |
}; | |
if (!doc.addEventListener) return; | |
win.addEventListener(resizeEvt, recalc, false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Promise(excutor) { | |
let self = this; | |
self.status = 'pending'; | |
self.value = null; | |
self.reason = null; | |
self.onFulfilledCallbacks = []; | |
self.onRejectedCallbacks = []; | |
function resolve(value) { | |
if(self.status === 'pending') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var proxyContext = function(ctx) { | |
return new Proxy(ctx, { | |
get(obj, prop) { | |
if (prop in obj) { | |
return obj[prop]; | |
} | |
const newCtx = proxyContext(ctx.clone()); | |
if (prop in rules) { | |
let re = newCtx.addRule(rules[prop]); | |
return re; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.reset = function () { | |
return process.stdout.write('\033c'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const waitFor = (ms) => new Promise(r => setTimeout(r, ms)) | |
const asyncForEach = (array, callback) => { | |
for (let index = 0; index < array.length; index++) { | |
await callback(array[index], index, array) | |
} | |
} | |
const start = async () => { | |
await asyncForEach([1, 2, 3], async (num) => { | |
await waitFor(50) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo -H pip install -U pipenv | |
# If you did a user install because you do not have sudo access, you have to modify your path to add your user folder | |
# The command on the next line tells you where your user folder is | |
# python3 -m site --user-base | |
PYTHON_BIN_PATH="$(python3 -m site --user-base)/bin" | |
PATH="$PATH:$PYTHON_BIN_PATH" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2020-06-02T09:16:19.677Z","extensionVersion":"v3.4.3"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"fmt" | |
"log" | |
"os" | |
"sort" | |
) | |
// askForConfirmation uses Scanln to parse user input. A user must type in "yes" or "no" and | |
// then press enter. It has fuzzy matching, so "y", "Y", "yes", "YES", and "Yes" all count as | |
// confirmations. If the input is not recognized, it will ask again. The function does not return |
OlderNewer