Skip to content

Instantly share code, notes, and snippets.

View jwulf's full-sized avatar
:octocat:
Coding on Halmak

Josh Wulf jwulf

:octocat:
Coding on Halmak
View GitHub Profile
@jwulf
jwulf / github-notification-cleanup-camunda-community-hub
Created November 30, 2023 19:13
Remove the Camunda Community Hub Organization prefix from the GitHub Notifications list
// ==UserScript==
// @name Camunda Community Hub - remove moniker in GitHub Notifications
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Remove the 'camunda-community-hub/' organization from the notification title
// @author You
// @match https://github.com/notifications*
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
// @grant none
// ==/UserScript==
@jwulf
jwulf / write.ts
Created May 31, 2021 01:01
A Magikcraft spell that writes words by transforming blocks
const magik = magikcraft.io;
/*
Fonts are bitmaps.
Each number is the decimal equivalent of the binary
bitmap of the line, for example: 00011000 = 24
Here is a bitmapped 'A':
00011000 = 24
00111100 = 60
00100100 = 36
@jwulf
jwulf / nact-mre.ts
Last active February 15, 2021 06:13
A minimal attempt to strongly type a query response
import { dispatch, spawn, query, Ref, start } from "nact";
type Result = { success: boolean };
type DoLoadMessage = {
type: "LOAD";
filename: string;
sender: Ref<Result>;
};
@jwulf
jwulf / naive-ratio-rate-limiter.ts
Created December 1, 2020 03:05
A naive functional rate limiter that prevents queue starvation
interface QueuedTask<T> {
task: () => T;
promise: {
resolve: (res: any) => void;
reject: (err: any) => void;
};
}
interface RateLimitedTask<T> {
task: () => T;
@jwulf
jwulf / naive-rate-limiter.ts
Created December 1, 2020 01:03
A naive functional rate limiter with an absolute limit
interface QueuedTask<T> {
task: () => T;
promise: {
resolve: (res: any) => void;
reject: (err: any) => void;
};
}
interface RateLimitedTask<T> {
task: () => T;
@jwulf
jwulf / CONTRIBUTING.template.md
Last active September 17, 2020 05:38
Zeebe Community Contribution Guidelines
@jwulf
jwulf / outline.md
Last active May 12, 2020 02:42
Camunda Cloud Getting Started Video: Node.js
  • Prerequisites: Node, npm, TypeScript, Zeebe Modeler
  • Scaffold new project
  • Create new Camunda Cloud account
  • Create new Camunda Cloud cluster
  • Point them to the Slack channel for support
  • Create new worker credentials
  • Put worker credentials in .env file
  • Create BPMN model: Start event, single service task, end event
  • Save model
  • Write code to deploy model, log response to console
async function executeAsyncTasks(tasks: AsyncTask<any>[]) {
const success = async res => ({ success: await res }) // Promise<{success: res}>
const error = async err => ({ error: await err }) // Promise<{error: e}>
const runWithResult = task => task.run()
.then(result => {
success(result)
task._success(result)
})
.catch(e => {
class AsyncTask<T> {
_run: () => Promise<T>;
_success: (result: T) => void;
_error: (e: Error) => void;
constructor({
error,
run,
success
}: {
// Takes an array of async tasks that may throw of shape {run: () => Promise<result>}
// Returns Promise<{error: error[], success: result[]}>
async function executeAsyncTasks(arrayOfAsyncTasks) {
const success = async res => ({ success: await res }) // Promise<{success: res}>
const error = async err => ({ error: await err }) // Promise<{error: e}>
const runWithResult = task => task.run().then(success).catch(error)
const outcomes = await Promise.all(arrayOfAsyncTasks.map(runWithResult))