Skip to content

Instantly share code, notes, and snippets.

View nathanborror's full-sized avatar

Nathan Borror nathanborror

View GitHub Profile
@dedlim
dedlim / claude_3.5_sonnet_artifacts.xml
Last active November 14, 2024 08:36
Claude 3.5 Sonnet, Full Artifacts System Prompt
<artifacts_info>
The assistant can create and reference artifacts during conversations. Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity.
# Good artifacts are...
- Substantial content (>15 lines)
- Content that the user is likely to modify, iterate on, or take ownership of
- Self-contained, complex content that can be understood on its own, without context from the conversation
- Content intended for eventual use outside the conversation (e.g., reports, emails, presentations)
- Content likely to be referenced or reused multiple times
@d-srd
d-srd / FunctionBuilderTesting.swift
Created July 10, 2019 00:16
testing the new Swift function builders for creating a simple routing system
//
// RouteBuilder.swift
// RouteBuilder
//
// Created by Dino on 09/07/2019.
// Copyright © 2019 Dino Srdoc. All rights reserved.
//
import Foundation
@Philmod
Philmod / google-container-kubernetes.js
Last active November 26, 2018 18:10
Deploy a new image from Google Cloud Container Builder to Kubernetes, using Google Cloud Functions.
const async = require('async');
const google = require('googleapis');
const k8s = require('kubernetes-client');
const container = google.container('v1');
const PROJECT_ID = 'node-example-gke';
const ZONE = 'us-east1-b';
const CLUSTER_ID = 'node-example-cluster';
const NAMESPACE = 'default';
_viewControllerFlags (struct ?): {
appearState (b2): 0
isEditing (b1): NO
isPerformingModalTransition (b1): NO
hidesBottomBarWhenPushed (b1): NO
autoresizesArchivedViewToFullSize (b1): NO
viewLoadedFromControllerNib (b1): NO
isRootViewController (b1): NO
customizesForPresentationInPopover (b1): NO
isSuspended (b1): NO
@andymatuschak
andymatuschak / States-v3.md
Last active November 14, 2024 18:33
A composable pattern for pure state machines with effects (draft v3)

A composable pattern for pure state machines with effects

State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?

There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.

Here I present a composable pattern for pure state machiness with effects,

@MrAlek
MrAlek / hamburger.swift
Created December 6, 2015 19:09
Example of how to use presentation, animation & interaction controllers w/ custom segues to create a slide-in modal menu which partially covers presenting view.
import UIKit
enum Direction {
case Left, Right, Up, Down
var pointVector: CGPoint {
switch self {
case Left: return CGPoint(x: -1, y: 0)
case Right: return CGPoint(x: 1, y: 0)
case Up: return CGPoint(x: 0, y: -1)