Skip to content

Instantly share code, notes, and snippets.

View jzohrab's full-sized avatar
💭
Not sick ... yet. Good luck, and stay safe. jz

JZ jzohrab

💭
Not sick ... yet. Good luck, and stay safe. jz
View GitHub Profile
@jzohrab
jzohrab / DataTablesMySqlQuery.php
Last active December 19, 2022 06:08
Symfony DataTables-to-mysql query builder
<?php
namespace App\Repository;
/**
* Utility repo for Mysql backend for DataTables ajax calls.
*/
class DataTablesMySqlQuery
{
@jzohrab
jzohrab / asyncPool.js
Last active February 24, 2024 09:21
Javascript async pool - exec async functions in a pool of fixed sized
/** Async pool
* Originally seen at https://github.com/rxaviers/async-pool/blob/master/lib/es6.js
* Simplified thanks to u/GSLint in
* https://www.reddit.com/r/learnjavascript/comments/gebobv/cant_grok_asyncpool_es6_code/
*/
/** Run asyncFunction array, poolSize at a time. */
async function asyncPool (array, poolSize) {
const result = []
const pool = []
@jzohrab
jzohrab / list_todos.py
Last active April 4, 2021 20:25
Python list TODOs
# Helper method to dump project TODOs to stdout.
#
# Script can be stored anywhere, but should be run from the project
# root dir:
# python tools/list_todos.py
#
# Sample output:
#
# Current TODOs by category:
#
@jzohrab
jzohrab / attribute_provenance_spec.rb
Last active October 2, 2017 15:07
A quick-and-dirty Chef attribute provenance reporter using ChefSpec
# Attribute Provenance reporter
# -----------------------------
#
# Runs as a ChefSpec test and dumps two sections of data:
# 1. all attributes (data from `node.debug_value()`)
# 2. where each attribute is set. You can specify the attributes
# you want included with an ATTRS environment variable.
#
# Sample run:
#