Skip to content

Instantly share code, notes, and snippets.

View terkelg's full-sized avatar
🔵
Git'n stuff done

Terkel terkelg

🔵
Git'n stuff done
View GitHub Profile
@stephancasas
stephancasas / IntelligenceUIPlatterView.swift
Created February 14, 2025 23:49
A SwiftUI expression of Apple Intelligence' NSIntelligenceUIPlatterView — used to accent intelligence-enabled UI components.
//
// IntelligenceUIPlatterView.swift
//
// Created by Stephan Casas on 2/13/25.
//
import SwiftUI
import AppKit
import Combine
@denisenepraunig
denisenepraunig / ContentView.swift
Created November 25, 2023 01:45
SwiftUI Metal Shader changing background color based on mouse position
import SwiftUI
struct ContentView: View {
@State private var hoverLocation: CGPoint = .zero
@State private var isHovering = false
@State var toggleText = false
var body: some View {
ZStack {
Rectangle()
@khalidx
khalidx / node-typescript-esm.md
Last active February 23, 2025 05:46
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@stephancasas
stephancasas / open-messages-emoji-palette.jxa.js
Created October 26, 2023 15:00
Open the macOS Messages emoji palette.
#!/usr/bin/env osascript -l JavaScript
let _AXError;
const $attr = Ref();
const $windows = Ref();
const $children = Ref();
const kAXParentAttribute = 'AXParent';
const kAXChildrenAttribute = 'AXChildren';
@stephancasas
stephancasas / core-ax.jxa.js
Last active December 3, 2024 10:29
JXA Core AX Framework Bindings
#!/usr/bin/env osascript -l JavaScript
function run() {
const VSCode = axApp('com.microsoft.VSCode');
const window = axGet(VSCode, 'AXWindows')[0];
return axWindowSetBounds(window, 200, 200, 1200, 1400);
}
/**
@rain-1
rain-1 / LLM.md
Last active March 6, 2025 13:08
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@pesterhazy
pesterhazy / building-sync-systems.md
Last active March 8, 2025 22:25
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

@joshnuss
joshnuss / OAuthClient.js
Last active December 10, 2023 22:46
OAuth2 Client
import fetch from 'node-fetch'
// some provider data is copied from github.com/simov/grant
const providers = {
bogus: {
authorize_url: "http://localhost:8282/auth/request/path",
access_url: "http://localhost:8282/access/token/request",
},
google: {
@DavidWells
DavidWells / github-proxy-client.js
Last active March 3, 2025 17:47
Full Github REST api in 34 lines of code
/* Ultra lightweight Github REST Client */
// original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const token = 'github-token-here'
const githubClient = generateAPI('https://api.github.com', {
headers: {
'User-Agent': 'xyz',
'Authorization': `bearer ${token}`
}
})
const randomVectorInCone = (theta: number, target: THREE.Vector3) => {
const z = remap(Math.random(), [0, 1], [Math.cos(theta), 1])
const phi = remap(Math.random(), [0, 1], [0, 2 * Math.PI])
target.set(
Math.sqrt(1 - z * z) * Math.cos(phi),
Math.sqrt(1 - z * z) * Math.sin(phi),
z
)
target.normalize()