Skip to content

Instantly share code, notes, and snippets.

Pete Scopes pdscopes

  • Leeds, UK
Block or report user

Report or block pdscopes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
pdscopes /
Last active Jun 19, 2019
Function to expand a, partially, flattened dictionary out to a nested dictionary
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 = []
pdscopes / string_replace_nth.js
Created Sep 13, 2018
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"
View homebrew.mxcl.rabbitmq.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
<plist version="1.0">
pdscopes / calcRangePrecision.js
Last active Aug 11, 2016
Javascript calculate the toFixed precision for a given range
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) {
You can’t perform that action at this time.