Skip to content

Instantly share code, notes, and snippets.

View joncardasis's full-sized avatar
Hold on a sec. My pour over is on its second bloom.

Jon Cardasis joncardasis

Hold on a sec. My pour over is on its second bloom.
View GitHub Profile
@joncardasis
joncardasis / worktrees.md
Last active July 12, 2026 09:52
Organizing Git Worktrees

Organizing Git Worktrees with Colocation

Colocated (or "bare repo + worktrees") pattern is one of the most popular and cleanest way to organize git worktrees. Here's how it works:

The Structure

myproject/              # Parent directory (not a checkout itself)
├── .bare/              # The bare git repo (the actual .git data)
├── .git                # A file (not dir) pointing to .bare
@joncardasis
joncardasis / Storing-Images-On-Github.md
Last active July 3, 2026 22:28
Storing Images and Demos in your Repo

Storing Images and Demos in your Repo

In this quick walkthough you'll learn how to create a separate branch in your repo to house your screenshots and demo gifs for use in your master's readme.

How to

1. Clone a fresh copy of your repo

In order to prevent any loss of work it is best to clone the repo in a separate location to complete this task.

2. Create a new branch

Create a new branch in your repo by using git checkout --orphan assets

@joncardasis
joncardasis / cursor-disable-cmd-k.md
Created October 31, 2025 16:39
Disable Cursor overriding cmd+k clear

cmd+k is a normal keybindings in shells to clear. Cursor highjacks this keybindings for their generation in terminal. Update keybindings JSON to include the following to disable this behavior from Cursor.

{
    "key": "shift+cmd+k",
    "command": "cursorai.action.generateInTerminal",
    "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
  },
  {
 "key": "cmd+k",
@joncardasis
joncardasis / README.md
Last active March 4, 2026 13:57
Claude Code Statusline - Show tok and cost info

Claude Code Status Line

Example: [Opus 4.6 (1M context)] Context: 0% (↑339 ↓7.9k) | $0.53

  1. Place the above script in ~/.claude/statusline.sh

  2. Edit ~/.claude/settings.json to include a new key:

"statusLine": {

@joncardasis
joncardasis / inline-blame-settings.md
Created February 12, 2026 14:06
Better VSCode Inline Git Blame

The GitLens VSCode extension for inline git blames can eat IDE performance in large repos. I was able to significant improve it by removing the extension and using VSCode built-ins to achieve the same functionality.

"git.blame.editorDecoration.enabled": true,
"git.blame.editorDecoration.template": "${authorName}, ${authorDateAgo} • ${subject} (${hashShort})",
"git.blame.statusBarItem.enabled": true,
"git.blame.statusBarItem.template": "${authorName} (${authorDateAgo}) ${subject}"
@joncardasis
joncardasis / print-rive.ts
Created November 4, 2025 23:00
Parse and print contents of a rive file
import fs from 'fs'
import Rive, {
Alignment,
Fit,
Layout,
Rive,
RiveFile,
FileAsset,
useStateMachineInput,
} from '@rive-app/react-webgl2'
@joncardasis
joncardasis / memoizePromise.ts
Created December 10, 2025 21:36
Memoize an async function, caching the resolved value and deduplicate concurrent calls
/** Memoizes an async function, caching the resolved value and deduplicating concurrent calls */
export const memoizePromise = <T>(fn: () => Promise<T>): (() => Promise<T>) => {
let cached: T
let hasCached = false
let pending: Promise<T> | null = null
return () => {
if (hasCached) {
return Promise.resolve(cached)
}
@joncardasis
joncardasis / ColladaAnimationForXcode.py
Last active September 15, 2025 05:03
Convert Collada (.DAE) animation files for Xcode Scenekit Animation use by removing unnecessary data.
#!/usr/local/bin/python
# Jonathan Cardasis, 2018
#
# Cleans up a collada `dae` file removing all unnessasary data
# only leaving animations and bone structures behind.
# Combines multiple animation sequences into a single animation
# sequence for Xcode to use.
import sys
import os
import re
import {pseudoLocalizeString} from 'utils/pseudoLocalize'
describe('pseudoLocalizeString', () => {
it.each([
['Hello, world!', 'Ħḗḗḗŀŀǿǿǿ, ẇǿǿřŀḓ!'],
['Get help online.', 'Ɠḗḗḗŧ ħḗḗŀƥ ǿǿƞŀīīƞḗḗ.'],
[
'The quick brown fox jumps over the lazy dog',
'Ŧħḗḗḗ ɋŭŭŭīīīƈķ ƀřǿǿǿẇƞ ƒǿǿǿẋ ĵŭŭḿƥş ǿǿṽḗḗř ŧħḗḗ ŀȧȧẑẏ ḓǿǿɠ',
],
@joncardasis
joncardasis / jailbreak_protect.c
Last active August 28, 2025 11:56
iOS - Prevent debugger attachment in a jailbroken environment. Obfuscated by assembly and symbol mangling.
//
// jailbreak_protect.c
//
// Created by Jonathan Cardasis (C) on 10/11/19.
// Copyright © 2019 Jonathan Cardasis (C). All rights reserved.
//
// Source: https://medium.com/@joncardasis/mobile-security-jailbreak-protection-84aa0fbc7b23
// Simply include this file in your project and ensure the file's Target Membership
// is set to your app.