Skip to content

Instantly share code, notes, and snippets.

View idettman's full-sized avatar

Isaac A. Dettman idettman

View GitHub Profile
/**
* @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")
@idettman
idettman / bash.md
Last active February 26, 2020 10:05
cheatsheets

title: Bash scripting keywords:

  • Variables
  • Functions
  • Interpolation
  • Brace expansions
  • Loops
  • Conditional execution
  • Command substitution
@idettman
idettman / .editorconfig
Last active February 26, 2020 09:03
Example .editorconfig, .eslintrc, package.json, and .gitignore
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
@idettman
idettman / download-and-run-gist.js
Created January 14, 2020 04:42
Download and run gist JS
(function downloadAndRunCodeSnippet() {
// form rawGit proxy url
var ghUrl = 'bahmutov/code-snippets/master/first-paint.js';
var rawUrl = 'https://rawgit.com/' + ghUrl;
// download and run the script
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = rawUrl;
head.appendChild(script);
function stringSize(str) {
// JavaScript strings are unicode UTF-16 up to 2 bytes per character
return str.length * 2;
}
function objectSize(obj) {
return stringSize(JSON.stringify(obj));
}
var value = function value(key) {