This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// credit: https://stackoverflow.com/a/46647783/8457586 | |
const newStatefulPromise = (executor, ...args) => { | |
let currentState = "pending"; | |
let currentResult; | |
let promise; | |
const setResult = (state, result) => { | |
if (currentState !== "pending") { | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// supports: | |
// - throttling by calling handler only once after a given delay has passed since the last resize | |
// - pausing and resuming (with or without calling callback at resume) | |
// - observing multiple targets and ensuring the handler is called only once all are added | |
// - observing targets without calling the handler initially when adding, only when later resized | |
class ResizeObserverExt { | |
observer = null; | |
#waitingResolver = null; | |
#targets = new Set(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width" /> | |
<title></title> | |
<script src="helpers.js" charset="utf-8"></script> | |
<script src="flex-auto-size.js" charset="utf-8"></script> | |
<style type="text/css" media="screen"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'add_meta_boxes', 'add_getpaid_item_invoices_meta_box', 50 ); | |
function add_getpaid_item_invoices_meta_box() { | |
add_meta_box( 'wpinv_item_invoices', __( 'Item Purchases', 'invoicing' ), 'show_getpaid_item_purchases', 'wpi_item', 'normal' ); | |
} | |
function show_getpaid_item_purchases( $post ) { | |
// get this post and all children | |
$posts = get_children( array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function subscription_user_role_dbg_log( $data ) { | |
// error_log( print_r( $data, true ) ); | |
} | |
function edit_member_role( $method, $subscription ) { | |
$roles = array( | |
// <name of item> => <slug of wordpress user role> | |
"Class Membership" => "class_member", | |
"Centre Membership" => "centre_member", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import logging | |
import math | |
import string | |
import sys | |
import argparse | |
from collections.abc import Mapping, MutableMapping | |
from collections import Counter | |
import re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Uses only bash built-ins allowed in restricted mode | |
# Also includes a few functions that require some external commands, see | |
# FUNCTIONS THAT REQUIRE SOME EXTERNAL COMMANDS at the end | |
# TODO check for # of arguments; or an argument parser | |
function _echoarray { | |
# print array elements one per line | |
local IFS=$'\n' | |
echo "$*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
usage() { | |
cat <<EOF | |
Takes a list of usernames a writes a rule file to prepend each of these to each password canditate. | |
${BASH_SOURCE[0]} <options> <username or file> [<username or file> ...] | |
Options: | |
-@ Also take the base username if full one is an email |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# See -h for help | |
INTERACTIVE=1 | |
READ_ARGS=() | |
NASM_ARGS=() | |
OBJDUMP_ARGS=() | |
# Determine if interactive or stdin is redirected from file/heredoc/command | |
# output/etc |
NewerOlder