Skip to content

Instantly share code, notes, and snippets.

View kbridge's full-sized avatar

kq kbridge

  • Sunnydale
View GitHub Profile

USER 🧑‍💻

<session_context> This is the Gemini CLI. We are setting up the context for our chat. Today's date is Tuesday, April 14, 2026 (formatted according to the user's locale). My operating system is: darwin The project's temporary directory is: /Users/kq/.gemini/tmp/kq

  • Workspace Directories:
    • /Users/kq
  • Directory Structure:

USER 🧑‍💻

<session_context> This is the Gemini CLI. We are setting up the context for our chat. Today's date is Sunday, April 12, 2026 (formatted according to the user's locale). My operating system is: darwin The project's temporary directory is: /Users/kq/.gemini/tmp/kq

  • Workspace Directories:
    • /Users/kq
  • Directory Structure:

USER 🧑‍💻

<session_context> This is the Gemini CLI. We are setting up the context for our chat. Today's date is Sunday, April 12, 2026 (formatted according to the user's locale). My operating system is: darwin The project's temporary directory is: /Users/kq/.gemini/tmp/kq

  • Workspace Directories:
    • /Users/kq
  • Directory Structure:

🤖 Copilot CLI Session

Note

  • Session ID: 6497cf60-887f-437e-b7d4-9edc78296f91
  • Started: 6/21/2026, 1:27:30 AM
  • Duration: 6m 2s
  • Exported: 6/21/2026, 1:33:33 AM

@kbridge
kbridge / invent-a-natural-language-for-agents.md
Last active June 19, 2026 20:30
philosophy discussion between @kbridge and Copilot

🤖 Copilot CLI Session

Note

  • Session ID: de68a0ce-4b0c-4fec-a720-7a5fff2698dd
  • Started: 6/20/2026, 4:19:57 AM
  • Duration: 6m 40s
  • Exported: 6/20/2026, 4:26:37 AM

This is a random thought, don’t take it very seriously…

Most of our code is declarative. I don’t mean programming paradigms (because in that sense, most code would be imperative). I mean the way we write and organize it.

Adding a new feature usually requires modifying code in many places. Which…

  • makes it harder for readers to infer the original author’s intent.
  • makes it harder for maintainers to reason, because they have to navigate among different locations, especially when they don’t have an IDE with “Go To Definition” functionality.
  • even makes meticulous programmers crazy because sometimes they may spend an unreasonable amount of time deciding where a new class member should go (add it to last, adapt an alphabetical order, or group it around members of a similar functionality?).
@kbridge
kbridge / phases.md
Last active December 25, 2025 23:58

Understanding the Phases Applicative

While I was researching how to do level-order traversals of a binary tree in Haskell, I came across a library called tree-traversals which introduced a fancy Applicative instance called Phases. It took me a lot of effort to understand how it works. Although I still have some unresolved issues, I want to share my journey.

Note: I was planning to post this article on Reddit. But I gave up because it was too long so here might be a better place.

See the discussion.

Note: This article is written in a beginner-friendly way. Experts may find it tedious.

@kbridge
kbridge / a.hs
Created February 20, 2024 09:40
demostrate monad transformers and forever
import Control.Monad
import Control.Monad.Trans.Class -- from `transformers`
import Control.Monad.Trans.Maybe -- from `transformers`
import Data.IORef
main :: IO ()
main = do
i <- newIORef (0 :: Int)
void $ runMaybeT $ forever $ do
n <- lift (readIORef i)
@kbridge
kbridge / rtti_does_more.cpp
Created January 25, 2024 19:11
RTTI does more than type-checking
#include <iostream>
#include <type_traits>
class Bird
{
public:
virtual ~Bird() = default;
};
class IFly
@kbridge
kbridge / cpp23_support.cpp
Last active January 24, 2024 11:44
play with new features added in cpp23. tested in VS2022 Version 17.8.2.
#include <iostream>
#include <version>
#ifdef __cpp_lib_print
# include <print>
#endif
#ifdef __cpp_lib_expected
# include <expected>
# include <system_error>