I've modified this script into a more user-friendly userscript
This file contains 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
def deep_extend(base, arg): | |
if not (isinstance(base, dict) and isinstance(arg, dict)): | |
return arg | |
return dict([ | |
*base.items(), | |
*map( | |
lambda item: ( | |
item[0], | |
deep_extend(base.get(item[0], None), item[1])), |
This file contains 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 deepExtend(base, arg) { | |
const baseType = typeof base | |
const argType = typeof arg | |
if (baseType !== argType || baseType !== 'object' || arg instanceof Array) { | |
return arg | |
} | |
return Object.fromEntries([ | |
...Object.entries(base), |
This file contains 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 appendableSetGenerator<T>(initialToTry?: IterableIterator<T>, tried = new Set<T>()): [Generator<T>, (...values: T[]) => void] { | |
const toTry = new Set<T>(initialToTry || null) | |
return [ | |
(function* () { | |
while (toTry.size) { | |
for (const value of toTry.values()) { | |
tried.add(value) | |
toTry.delete(value) | |
yield value | |
break |
This file contains 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 sanitizeHTML from 'sanitize-html' | |
const wysiwygSel = '.wysiwyg' | |
const allowedTags = [ | |
'b', | |
'i', | |
'u', | |
'br', | |
] |
This file contains 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
<template> | |
<input type="number" @keydown.native="onKeydown" :value="value" @input="onInput" :min="min" :max="max" :step="step" v-bind="$attrs" /> | |
</template> | |
<script> | |
export default { | |
name: 'NumberInput', | |
props: { | |
value: { | |
type: Number, |
This file contains 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 roundPadded(n, d = 0) { | |
const div = Math.pow(10, d) | |
let res = (Math.round(n * div) / div).toString().split('.') | |
const whole = res[0] | |
if (d <= 0) { | |
return whole | |
} | |
let dec = res[1] || '' | |
if (d > 0 && dec.length < d) { | |
dec += '0'.repeat(d - dec.length) |
This file contains 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 jsonToCsv(headers, rows, rowSep="\r\n") { | |
function escape(value) { | |
return `"${value.toString().replace('"', '""')}"` | |
} | |
function row(values) { | |
return values.map(escape).join(',').replace(/(,"")+$/, '') | |
} | |
return row(headers) + rowSep + rows.map(row => { | |
return headers.map(header => row[header] || '') | |
}).map(row).join(rowSep) |
This file contains 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
pragma solidity ^0.4.11; | |
/** | |
* @title Ownable | |
* @dev The Ownable contract has an owner address, and provides basic authorization control | |
* functions, this simplifies the implementation of "user permissions". | |
*/ | |
contract Ownable { | |
address public owner; |
This file contains 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
<?php | |
// Args: | |
// SafeQuery::safe_query($table, $select_fields = array("*"), $where = array(), $order_by = array(), $limit = array(0,100)) | |
$ops = array( | |
"equals" => array("="), | |
"not_equals" => array("!="), | |
"greater_than" => array(">"), | |
"greater_than_or_equal" => array(">="), | |
"less_than" => array("<"), |
NewerOlder