Skip to content

Instantly share code, notes, and snippets.

View rschiang's full-sized avatar
🐳
Sailing

Poren Chiang rschiang

🐳
Sailing
View GitHub Profile
@simonbs
simonbs / View+ErrorAlert.swift
Created September 3, 2025 18:44
SwiftUI view modifier for presenting an alert when an error binding has a value.
import SwiftUI
public extension View {
func alert<Message: View, Actions: View>(
_ title: LocalizedStringResource,
presenting error: Binding<Error?>,
@ViewBuilder message: @escaping (Error) -> Message,
@ViewBuilder actions: @escaping () -> Actions
) -> some View {
modifier(
@florianpircher
florianpircher / Fonts.swift
Created March 7, 2024 20:21
NSFont extensions for setting OpenType features and variation axes
//
// Fonts.swift
//
// Copyright 2021 Florian Pircher
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0

Comparing PDF files in git diff commands

The typical approach to comparing PDF files in git diff outputs amounts to converting PDF files into texts through pdftotext and show the diff of conversion.

  1. Install the utility pdftotext from the project poppler
  2. Enable the handler pdffiles in diff for PDF files and instruct the handler to call the pdf-astextplain script:
// ==UserScript==
// @name @chaoticvibing Twitter Blue Nerd - twitter.com
// @namespace Violentmonkey Scripts
// @match *://*.twitter.com/*
// @match *://*.x.com/*
// @grant none
// @version 1.9.2
// @author @chaoticvibing - GH @busybox11
// @description 11/9/2022, 11:45:28 PM
// @updateURL https://gist.githubusercontent.com/busybox11/53c76f57a577a47a19fab649a76f18e3/raw
@facelessuser
facelessuser / okhsl.py
Last active August 4, 2025 16:15
Okhsl and Okhsv
"""
Okhsl class.
Translation to/from Oklab is licenced under MIT by the original author, all
other code also licensed under MIT: Copyright (c) 2021 Isaac Muse.
---- Oklab license ----
Copyright (c) 2021 Björn Ottosson
@toricls
toricls / lima-on-m1-mac-installation-guide.md
Last active November 9, 2024 23:03
Using Lima to run containers with containerd and nerdctl (without Docker Desktop) on M1 Macs

Lima (Linux virtual machines, on macOS) installation guide for M1 Mac.

Sep. 27th 2021 UPDATED

Now we can install patched version of QEMU via Homebrew (thank you everyone for the info!). Here is the updated instruction with it:

Used M1 Mac mini 2020 with macOS Big Sur Version 11.6.

1. Install QEMU & Lima

@Myndex
Myndex / ForTheLuvOfColor.md
Last active July 30, 2025 21:56
A comparative look at Lab and Luv colorspaces, and LCh.

Where's The Luv?

An Examination of the CIELAB and CIELUV colorspaces.

It is exciting to see so many new color features for the CSS Color Module. There are nevertheless a couple items that resulted in a "raised eyebrow response". This Gist is mainly going to focus on one: the use of the LAB version of LCh instead of LUV LCh, which may be better suited for the task but appears to have been dismissed as if irrellevant.

I DISAGREE. Luv is in common use and very relevant, and LuvLCh or one of the several LuvLCh variants has distinct advantages over LabLCh for use cases such as choosing color for web content for displays.

Myth Destruction

@avaidyam
avaidyam / BackdropView.swift
Created July 2, 2020 17:23
DIY NSVisualEffectView using Private API for macOS
// TODO: setting window transforms (or mission control) flattens layers...
// TODO: Mask image vs path (layer)?
/// `NSVisualEffectView`:
///
/// A view that adds translucency and vibrancy effects to the views in your interface.
/// When you want views to be more prominent in your interface, place them in a
/// backdrop view. The backdrop view is partially transparent, allowing some of
/// the underlying content to show through. Typically, you use a backdrop view
/// to blur background content, instead of obscuring it completely. It can also
@sidneys
sidneys / library.on-element-ready.js
Last active December 22, 2023 02:25
UserScript | Library | onElementReady ES6
// ==UserScript==
// @name Library: onElementReady ES7
// @namespace org.sidneys.userscripts
// @homepage https://gist.githubusercontent.com/sidneys/ee7a6b80315148ad1fb6847e72a22313/raw/
// @version 0.8.1
// @description Detect any new DOM Element by its CSS Selector, then trigger a function. Includes Promise- & Callback interface. Based on ES6 MutationObserver. Ships legacy waitForKeyElements interface, too.
// @author sidneys
// @icon https://i.imgur.com/nmbtzlX.png
// @match *://*/*
// ==/UserScript==