View expand_dict.py
def expand_dict(dct, delimiter: str = '.') -> dict: | |
""" | |
Expand a (partially) flattened dot-notation dictionary. | |
:param dct: Dictionary/list to be expanded | |
:param delimiter: String that delimits flattened keys | |
:return: Expanded dictionary/list | |
""" | |
if isinstance(dct, dict): | |
stale_keys = [] |
View string_replace_nth.js
String.prototype.replace_nth = function (searchValue, replaceValue, n) { | |
let i = 0; | |
return this.replace(searchValue, function (match) { return (++i === n) ? replaceValue : match; }); | |
}; |
View phpunit.xml
<?xml version="1.0" encoding="UTF-8"?> | |
<phpunit backupGlobals="false" | |
backupStaticAttributes="false" | |
bootstrap="vendor/autoload.php" | |
colors="true" | |
convertErrorsToExceptions="true" | |
convertNoticesToExceptions="true" | |
convertWarningsToExceptions="true" | |
processIsolation="false" | |
stopOnFailure="false"> |
View homebrew.mxcl.rabbitmq.plist
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" | |
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>homebrew.mxcl.rabbitmq</string> | |
<key>Program</key> | |
<string>/usr/local/opt/rabbitmq/sbin/rabbitmq-server</string> | |
<key>RunAtLoad</key> |
View calcRangePrecision.js
/** | |
* Calculates the toFixed precision required for nicely displaying | |
* step intervals between the values given. | |
* | |
* @param int min Minimum value in set | |
* @param int max Maximum value in set | |
* | |
* @return int Number.toFixed precision | |
*/ | |
function calcRangePrecision(min, max) { |