Skip to content

Instantly share code, notes, and snippets.

View deanrad's full-sized avatar
🎯
Staying On Target

Dean Radcliffe deanrad

🎯
Staying On Target
View GitHub Profile

Here are my indispensible git command-line tricks:

  • gh pr checkout NNNN - Check out a numbered PR to your working tree
  • gl3 - See the last 3 commits
  • gco - - Check out the last branch you were on
  • gco branch-name - Check out a local branch by full name
  • gbm DateInput - Shows git branches matching a pattern
  • gco $(gbm DateInput) - Check out the DateInput branch
  • glb - "Git last branches" - print a list of the most recent branches you've checked out
  • gro - "Git reset origin" - Does a reset to the remote branch, not merging with local edits

Regarding Logger functions and Uncaught Exceptions from Destinations

If one of the log functions throws an uncaught exception, what is affected? Some possibilities - all of which you'd probably want to avoid - are:

  • Some of the other loggers wouldn't fire
  • The code that triggered the log() call would see the exception.
  • The entire app might shut down

Now, if log destinations are explicitly try/catch wrapped, this is not an issue. But we might forget to do so. An Event Bus could help here. The event bus style of a logger would be: rather than composing multiple functions into a single one, each log destination becomes a bus listener. Let's say we have a dedicated Bus for logging, here's how we can write a log() function that puts a message on the bus for listener destinations to pick up:

Time Sheet (parody of Time Warp)
In accounting, the books they're keeping
Over money, they have the power
So mark time closely, under Capital, mostly
Reflecting your every hour
I remember doing the timesheet,
Fridays, whoa but then!
The last day of the month fell
<!DOCTYPE html>
<html>
<head>
<title>TimeHop Your Inbox</title>
<meta charset="utf-8" />
<!-- Load dependencies -->
<script src="https://unpkg.com/rxjs@7.8.0/dist/bundles/rxjs.umd.js"></script>
<script src="https://unpkg.com/antares-protocol/dist/antares-protocol.js"></script>
<script src="https://unpkg.com/redux@4.0.0/dist/redux.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.4.2/umd/react.production.min.js"></script>

LEADERSHIP LAB: The Craft of Writing Effectively https://www.youtube.com/watch?v=vtIzMaLkCaM

My takeaways:

  1. This course is not about writing rules 3:04
  2. Stop thinking about rules and start thinking about readers 3:55
  3. The problems that domain experts have in their writing 4:00
  4. Domain experts use writing to help themselves with thinking 4:51, if they don't do it this way, they can't think to the level they need
  5. The challenge: the way that experts do their writing (to help with their thinking) is different to the way that readers can understand 6:53
  6. The consequences 8:10 - 1. readers need to slow down and re-read many times 2. readers can't understand or misunderstand 3. readers give up
@deanrad
deanrad / machine.js
Created April 20, 2022 04:01
Generated by XState Viz: https://xstate.js.org/viz
const timerMachine = Machine({
context: {
elapsed: 0,
duration: 5,
interval: 0.01
},
initial: "running",
on: {
RESET: {
target: "running",
@deanrad
deanrad / machine.js
Last active October 2, 2022 14:19
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
const { Omnibus } = require("omnibus-rxjs");
const fs = require("fs");
const { join } = require("path");
const bus = new Omnibus();
bus.spy(({ type, payload }) => console.log(type, payload));
const dirPath = "./";
const jsonMaker = bus.filter(
({ type }) => type === "png",
@deanrad
deanrad / machine.js
Created January 11, 2022 23:22
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@deanrad
deanrad / 2FA.md
Created November 11, 2021 02:29
⭐️ Polyrhythm Design Language for Distributed Systems
<title>⭐️ Polyrhythm Design Language for Distributed Systems</title>