Skip to content

Instantly share code, notes, and snippets.

View hboon's full-sized avatar
Indie hacking

Hwee-Boon Yar hboon

Indie hacking
View GitHub Profile
@hboon
hboon / swift-testing-playbook.md
Created June 8, 2025 00:58 — forked from steipete/swift-testing-playbook.md
The Ultimate Swift Testing Playbook (feed it your agents for better tests!)

The Ultimate Swift Testing Playbook (2024 WWDC Edition, expanded with Apple docs from June 2025)

Updated with info from https://developer.apple.com/documentation/testing fetched via Firecrawl on June 7, 2025.

See also my blog: See also my blog post: https://steipete.me/posts/2025/migrating-700-tests-to-swift-testing

A hands-on, comprehensive guide for migrating from XCTest to Swift Testing and mastering the new framework. This playbook integrates the latest patterns and best practices from WWDC 2024 and official Apple documentation to make your tests more powerful, expressive, and maintainable.


1. Migration & Tooling Baseline

@hboon
hboon / claude_dr_prompt.md
Created June 7, 2025 23:45 — forked from XInTheDark/claude_dr_prompt.md
Custom Deep Research prompt for Claude

Notes

  • MCP servers enabled: Brave Search, Fetch, Puppeteer (optional).
  • Recommended way to use it: create a project "Deep Research" and add the prompt as custom instructions.
  • Recommended model: Sonnet 4 with Thinking. Sonnet vs Opus does not make much difference from experience.
  • (As of the time of writing,) Do not enable Claude's built-in web search feature!
    • I've compared the two versions and the quality difference is significant.
    • It seems that the built-in system prompt that gets enabled, is terrible for deep research. A few examples: It explicitly limits Claude to only running one or a few searches in most cases; it contains numerous instructions regarding never quoting directly,
@hboon
hboon / boilerplate.swift
Created December 28, 2022 03:49 — forked from chriseidhof/boilerplate.swift
QuickMacApp
// Run any SwiftUI view as a Mac app.
import Cocoa
import SwiftUI
NSApplication.shared.run {
VStack {
Text("Hello, World")
.padding()
.background(Capsule().fill(Color.blue))
@hboon
hboon / GuardURLProtocol.swift
Created October 14, 2022 07:32 — forked from brunophilipe/GuardURLProtocol.swift
GuardURLProtocol class to monitor all connections initiated by app
//
// GuardURLProtocol.swift
// URLProtocol
//
// Created by Bruno Philipe on 16/2/17.
// Copyright © 2017 Bruno Philipe. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@hboon
hboon / gist:45dbd21537a5564b975420527e9eed7f
Created June 19, 2019 12:25 — forked from steipete/ios-xcode-device-support.sh
Using iOS 13 devices with Xcode 10.2 (instead of Xcode 11)
// The trick is to link the DeviceSupport folder from the beta to the stable version.
// sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
// Xcode 10.2 to Xcode 11 Beta
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/13.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
// Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
@hboon
hboon / WebCacheCleaner.swift
Created June 18, 2019 07:11 — forked from insidegui/WebCacheCleaner.swift
Clear WKWebView's cookies and website data storage, very useful during development.
import Foundation
import WebKit
final class WebCacheCleaner {
class func clean() {
HTTPCookieStorage.shared.removeCookies(since: Date.distantPast)
print("[WebCacheCleaner] All cookies deleted")
WKWebsiteDataStore.default().fetchDataRecords(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes()) { records in
@hboon
hboon / jscore.md
Created July 16, 2018 05:03 — forked from mheiber/jscore.md
Using JavaScriptCore in a Production iOS app

JavaScriptCore is a built-in iOS library that enables you to use JavaScript in apps alongside Objective-C and Swift. It lets developers read JavaScript from a string, execute it from Objective-C or Swift, and share data structures and functions across languages. We JavaScriptCore to share code between Web and iOS.

Sharing code helped us produce a high-quality, consistent experience across devices while iterating rapidly.

This post is about why we chose to use JavaScriptCore and what we learned. The biggest challenges to using JavaScriptCore in a production app were performance optimization for older devices and getting the build process right. Luckily, these problems have simple solutions that just weren't documented.

Why did we use JavaScriptCore?

A killer feature of one of our apps is search that is optimized for finding guests by name. Our goals included:

@hboon
hboon / iap.rb
Created February 5, 2018 15:17 — forked from amirrajan/iap.rb
# coding: utf-8
class IAPScene < SKScene
include ScreenSizes
attr_accessor :root
def button_size
device_screen_width.fdiv(buttons_per_row + 2)
end
@hboon
hboon / jsonp.js
Created July 14, 2017 07:42 — forked from gf3/jsonp.js
Simple JSONP in vanilla JS
/**
* loadJSONP( url, hollaback [, context] ) -> Null
* - url (String): URL to data resource.
* - hollaback (Function): Function to call when data is successfully loaded,
* it receives one argument: the data.
* - context (Object): Context to invoke the hollaback function in.
*
* Load external data through a JSONP interface.
*
* ### Examples
@hboon
hboon / pbkdf2test.c
Created November 11, 2016 21:05 — forked from lukhnos/pbkdf2test.c
An example of using CommonCrypto's PBKDF2 function
// an example of using CommonCrypto's PBKDF2 function
//
// build with:
//
// clang -o pbkdf2test pbkdf2test.c
//
// test with:
//
// ./pbkdf2test <some plaintext password here>