Skip to content

Instantly share code, notes, and snippets.

View idettman's full-sized avatar

Isaac A. Dettman idettman

View GitHub Profile
@idettman
idettman / add-to-existing-namespaces.js
Last active February 26, 2024 00:57
JavaScript: JSDoc Advanced Tips
/* https://leahayes.wordpress.com/2011/08/28/documenting-javascript-with-jsdoc3/
Namespaces can still be documented when a more abstract mechanism is used. @lends allows members to be added to an existing namespace:
*/
/**
* Root namespace
* @namespace root
*/
$namespace('root', /** @lends root **/ {
/**
@idettman
idettman / sort-files-by-year-date.bat
Created February 19, 2017 06:19
Powershell Script to Move Files to Folders sorted by Year and Date
# Get the files which should be moved, without folders
$files = Get-ChildItem 'C:\Users\Thomas\OneDrive\OneDrive Camera Roll' -Recurse | where {!$_.PsIsContainer}
# List Files which will be moved
$files
# Target Filder where files should be moved to. The script will automatically create a folder for the year and month.
$targetPath = 'C:\Users\Thomas\OneDrive\pictures\Albums'
foreach ($file in $files)
@idettman
idettman / color-conversion-util.js
Created September 26, 2017 13:19
Color Conversion util JavaScript
// Conversion formulas based on http://www.easyrgb.com/index.php?X=MATH, copyright 2012 IRO Group Limited
// Distance formula based on "CMC l:c" from http://www.brucelindbloom.com/index.html?Eqn_DeltaE_CMC.html
// http://www.easyrgb.com/index.php?X=MATH&H=15#text15
Color = {
"A" :{"2":[109.85,100.0,35.585], "10":[111.144,100.0,35.2]},
"C" :{"2":[98.074,100.0,118.232],"10":[97.285,100.0,116.145]},
"D50":{"2":[96.422,100.0,82.521], "10":[96.72,100.0,81.427]},
"D55":{"2":[95.682,100.0,92.149], "10":[95.799,100.0,90.926]},
"D65":{"2":[95.047,100.0,108.883],"10":[94.811,100.0,107.304]},
@idettman
idettman / json-util.js
Created June 6, 2017 03:23
JSON Utils
/**
* Check for equality between two objects based on JSON stringification
* @param {Object} objectA
* @param {Object} objectB
*/
export const jsonStringifyEquality = (objectA, objectB) => {
return JSON.stringify(objectA) === JSON.stringify(objectB);
}
/**
* @param {Object} obj
* @returns {string}
*/
function getFirstKey(obj) {
return Object.keys(obj)[0];
}
@idettman
idettman / prebid-pull-request-example.md
Last active April 8, 2020 18:36
Prebid.js Pull Request Example

Type of change

  • Other

Description of change

Updated Prebid Server bid adapter to check for the site object in the prebid configuration. If exists, this will be copied over into the request and publisher/page will either be created properties or will overwrite existing config defined values. This will allow other OpenRTB fields within the site object to be passed to Prebid Server, i.e. site.content

Other information

#3783 pass site.{} into prebid server request

@idettman
idettman / multithreading-que.md
Last active March 12, 2020 05:26
Python Multithreading: Queues

Python Multithreading and Queues

A queue is similar to a list:

from Queue import Queue

my_list = []
my_list.append(1)
my_list.append(2)
@idettman
idettman / parpipeline.js
Created March 7, 2020 08:07
JavaScript Parallel Pipeline API
var ParallelPipeline = (function() {
var { objectType, ArrayType, Any } = TypedObject;
function fromFunc(shape0, func, grainType) {
var shape = [];
if ((shape0 | 0) === shape0)
shape.push(shape0 | 0);
else {
for (var i = 0; i < shape0.length; i++) {
if ((shape0[i] | 0) !== shape0[0])
@idettman
idettman / cookie-utils.js
Created March 7, 2020 07:15
JavaScript Cookie Utils
@idettman
idettman / pikathreading.py
Last active February 28, 2020 02:56
python pika threading example
def receive_command():
print("ENTERED")
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
print("1")
channel = connection.channel()
print("2")
channel.exchange_declare(exchange='STORE_CMD', type='topic')
print("3")
result = channel.queue_declare(exclusive=True)
print("4")