Skip to content

Instantly share code, notes, and snippets.

View dorelljames's full-sized avatar
馃幆
Focusing

Dorell James dorelljames

馃幆
Focusing
View GitHub Profile
@dorelljames
dorelljames / herdr-notify.zsh
Created August 19, 2026 16:22
zsh - auto-notify via herdr when long shell commands finish
# Notify through herdr when a long-running command finishes.
#
# Why this exists (2026-08-20): herdr only sends lifecycle notifications
# for things it recognizes as agents. A plain `composer qa` or
# `sail artisan test` finishes silently, so switching to another tab
# means polling the old one. This hook times every interactive command
# and raises a herdr notification when a slow one returns. The exit
# code picks the sound: "done" for success, "request" for failure.
#
# Lives in $ZSH_CUSTOM, so oh-my-zsh sources it automatically.
@dorelljames
dorelljames / init.lua
Created February 19, 2026 12:52
Hammerspoon: Toggle Ghostty on current Space with Option+Escape
-- Toggle Ghostty on current Space with Option+Escape
-- Only activates if Ghostty has a window on the current Space.
-- If no Ghostty window here, does nothing (no desktop switching).
hs.hotkey.bind({"alt"}, "escape", function()
local app = hs.application.find("ghostty")
if not app then
hs.application.launchOrFocus("Ghostty")
return
end
@dorelljames
dorelljames / encryptForGitHub
Created February 28, 2024 05:45
Encrypt values for storing on GitHub Secrets
import sodium from "libsodium-wrappers";
// publicKey is from GET /repos/{owner}/{repo}/actions/secrets/public-key
// secretValue is the value you want to get encrypted
export async function encryptForGitHub(secretValue: string, publicKey: string) {
await sodium.ready;
// Convert the secret and key to a Uint8Array.
const binkey = sodium.from_base64(publicKey, sodium.base64_variants.ORIGINAL);
const binsec = sodium.from_string(secretValue);
@dorelljames
dorelljames / recover-schema.md
Created March 14, 2023 13:09 — forked from bjoerge/recover-schema.md
How to recover lost schema from *.sanity.studio.md

First, go to https://<yourname>.sanity.studio (or to the url of your studio if it's hosted elsewhere). Then open the developer console (usually by one of the keyboard shortcuts Command+Option+I, F12 or Control+Shift+I depending on what browser/platform you are using)

Steps

  1. Open the Sources tab
  2. Find the app.bundle.js file in the sidebar tree view.
  3. Hit the pretty print source button
  4. Locate your schema types by searching (e.g. try searching for one of your custom types) it in the source view.
@dorelljames
dorelljames / machine.js
Created August 26, 2022 10:23
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@dorelljames
dorelljames / machine.js
Last active August 26, 2022 05:21
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@dorelljames
dorelljames / machine.js
Last active September 29, 2021 16:49
Generated by XState Viz: https://xstate.js.org/viz
const allProducts = ["Auction! Desktop", "Auction! Cloud", "Auction! Online", "Auction! Mobile", "Auction! Reservations"];
const orderMachine = Machine({
id: 'order',
initial: 'idle',
context: {
cart: [],
loggedInuser: {
organizations: null,
profile: null
@dorelljames
dorelljames / machine.js
Created October 30, 2020 17:46
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: "electricFan",
type: "parallel",
states: {
power: {
id: "power",
initial: "turnedOff",
states: {
turnedOff: {
on: {
@dorelljames
dorelljames / machine.js
Created October 30, 2020 11:04
Generated by XState Viz: https://xstate.js.org/viz
const trafficLightMachine = Machine({
id: "trafficLight",
initial: "red",
on: {
NEXT: "green"
}
})
@dorelljames
dorelljames / webtask-io-scrollable.md
Created September 10, 2019 08:03
Make webtask.io "Explorer" sidebar scrollable

Objective

Fix the annoying Explorer sidebar of webtask.io and make it scrollable. 馃槉

How?

I use Google Chrome browser so I installed User CSS extension which basically allows one to add custom CSS to add a website.

Here's the custom css to add: