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 base64 | |
import binascii | |
import secrets | |
from starlette.authentication import ( | |
AuthCredentials, AuthenticationBackend, AuthenticationError, SimpleUser | |
) | |
from starlette.requests import HTTPConnection | |
from starlette.responses import Response, JSONResponse | |
from starlette.middleware import Middleware |
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
// https://www.reddit.com/r/javascript/comments/n2td8/implementing_printf_in_javascript/ | |
// https://stackoverflow.com/questions/29085197/how-do-you-json-stringify-an-es6-map | |
function sprintf(msg, ...args) { | |
return msg.replace(/(%[disv])/g, (match, val) => { | |
let arg = args.shift(); | |
if (typeof arg !== 'undefined') { | |
switch(val.charCodeAt(1)) { | |
case 100: return +arg; // d | |
case 105: return Math.round(+arg); // i |
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
class JsonStorage { | |
constructor(storage) { | |
this.storage = storage; | |
} | |
clear() { | |
this.storage.clear(); | |
} |
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 loadScript(url, onload) { | |
fetch(url) | |
.then(function(response) { | |
if (!response.ok) { | |
throw new Error(`HTTP error. Status: ${response.status}`); | |
} | |
return response.blob(); | |
}) | |
.then(function(blob) { | |
let objectUrl = URL.createObjectURL(blob), |
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 prettify (num, separator) { | |
var n = (typeof num === "string") ? num : num.toString(); | |
var sep = typeof separator === "undefined" ? " " : separator; | |
return n.replace(/(\d{1,3}(?=(?:\d\d\d)+(?!\d)))/g, "$1" + sep); | |
} | |
// SUMM TABLE ROWS | |
function sumTableRows() { | |
var table = document.getElementById("mainTab"); | |
let lastRow = table.rows[table.rows.length - 1]; |
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
<toolSet name="Code Checking"> | |
<tool name="Flake8" showInMainMenu="true" showInEditor="true" showInProject="true" showInSearchPopup="true" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="true"> | |
<exec> | |
<option name="COMMAND" value="$PyInterpreterDirectory$/python" /> | |
<option name="PARAMETERS" value="-m flake8 --max-complexity 10 --ignore E501 $FilePath$" /> | |
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" /> | |
</exec> | |
<filter> | |
<option name="NAME" value="Filter 1" /> | |
<option name="DESCRIPTION" /> |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import lxml.html | |
from lxml.etree import tostring as etree_tostring | |
import re | |
import SocketServer | |
import SimpleHTTPServer | |
import shutil | |
import StringIO | |
import urllib2 |