Skip to content

Instantly share code, notes, and snippets.

View vandorjw's full-sized avatar

Joost van Dorp vandorjw

View GitHub Profile
//ensure we instantiate the listeneres on page-load.
window.addEventListener("DOMContentLoaded", AddFileEventListeners);
// add-form.formset is a custom event that is only 'emitted' by the formset.js file
// When new forms are added to the page, we need those forms to also have an event listener
// not just the ones that were present on page load.
document.querySelector('form').addEventListener("add-form.formset", AddFileEventListeners);
function Formset(element) {
/*
Dynamic Formset handler for Django formsets.
Events:
* init.formset
* add-form.formset
* remove-form.formset
* renumber-form.formset
@vandorjw
vandorjw / bitbucket-pipelines.yml
Last active August 15, 2022 21:00 — forked from keepitsimple/bitbucket-pipelines.yml
Bitbucket pipeline to sync / copy code commits to GitHub. How to sync Bitbucket repo to GitHub
image: python:3.8
definitions:
services:
docker:
memory: 1024
steps:
- step: &Push-to-GitHub
name: Push code changes to GitHub

Keybase proof

I hereby claim:

  • I am vandorjw on github.
  • I am vandorjw (https://keybase.io/vandorjw) on keybase.
  • I have a public key ASB8VzK8d_QSxidWFi-Gh35U7EusDXBTdU-CwZOKHzA41Qo

To claim this, I am signing this object:

@vandorjw
vandorjw / loopback-latency.sh
Created July 30, 2021 20:25 — forked from keturn/loopback-latency.sh
use netem to add latency to loopback network traffic
#!/bin/bash
#
# https://wiki.linuxfoundation.org/networking/netem#Emulating_wide_area_network_delays
#
# Add latency to all outgoing traffic on $DEV on tcp/udp $PORT,
# in the amount of $DELAY.
#
# This is matching on both source port and destination port, which
# may hit you twice if you're accessing a local resource.
#
ffmpeg -i recording.mkv -r 15 -vf "scale=1024:-1,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -ss 00:00:00 -to 00:00:20 output.gif
breakpoint at line 614 from client.py
-- DOUBLE ACTIVE SUBSCRIPTIONS
select
s.subscription_id,
o.order_id,
s.next_billing_date as sub_billing_date,
o.billing_date as order_billing_date,
o.status as order_status,
s.status as subscription_status,
o.first_name,
o.last_name
/**
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes
*
* JavaScript classes, introduced in ECMAScript 2015,
* are primarily syntactical sugar over JavaScript's existing prototype-based inheritance.
*
* The class syntax does not introduce a new object-oriented inheritance model to JavaScript.
*
* I prefer to keep using the older style 'prototype' when writing code in JS.
*/
/**
* An example for how a tabbed component in Vue can be done.
*/
//VueX store
const store = new Vuex.Store({
state: {
user: {} // <<<--- this is object. use Vue.set() to manipulate for reactivity!!!
},
getters: {