Skip to content

Instantly share code, notes, and snippets.

@patgarner
patgarner / hellogame.c
Created March 18, 2025 09:57
RayLib "Hello, Word!" in C
/*
** Install raylib
Windows: https://github.com/raysan5/raylib/wiki/Working-on-Windows
Mac: https://github.com/raysan5/raylib/wiki/Working-on-macOS
Linux: https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux
** Example of how to compile the code with raylib using GCC on Mac
gcc -o hellogame hellogame.c -lraylib -framework OpenGL -framework Cocoa -framework IOKit
*/
@patgarner
patgarner / ContentView.swift
Created March 9, 2025 21:53 — forked from Koshimizu-Takehito/ContentView.swift
表示中のピクセルデータからボタンの色を切り替える
import SwiftUI
struct ContentView: View {
@State private var image = UIImage()
@State private var buttonRect = CGRect()
@State private var isBrightBackground = false
@State private var viewID = UUID()
var body: some View {
NavigationStack {
import UIKit
import SwiftUI
struct ContentView: View {
@Environment(\.self) var environment
var body: some View {
ZStack {
Color.red.brighter(0.3, environment).edgesIgnoringSafeArea(.all)
@patgarner
patgarner / Spiral.swift
Created December 31, 2024 22:41 — forked from Koshimizu-Takehito/Spiral.swift
アルキメデスのらせん
import SwiftUI
struct ContentView: View {
@State var start = Date()
var body: some View {
TimelineView(.animation) { context in
let time = context.date.timeIntervalSince(start) / 120
let rotation = 0.8 + 0.2 * abs((cos(.pi * time) + 1.0) / 2.0)
Canvas { context, size in
@patgarner
patgarner / st.txt
Created February 14, 2024 22:32 — forked from bryc/st.txt
Scream Tracker Manual (1990)
Scream Tracker
<<<<< USERS MANUAL >>>>>
(C) 1990 Sami Tammilehto
==============================================================================
@patgarner
patgarner / 32.asm
Created January 11, 2023 21:08 — forked from FiloSottile/32.asm
NASM Hello World for x86 and x86_64 Intel Mac OS X (get yourself an updated nasm with brew)
; /usr/local/bin/nasm -f macho 32.asm && ld -macosx_version_min 10.7.0 -o 32 32.o && ./32
global start
section .text
start:
push dword msg.len
push dword msg
push dword 1
mov eax, 4
@patgarner
patgarner / TidalCyclesQuickReferenceStub.tidal
Created December 19, 2020 04:54 — forked from mxactvtd/TidalCyclesQuickReferenceStub.tidal
TidalCycles Quick Reference compiled and partially rewritten documentation from various sources
---- TidalCycles QUICK REFERENCE ----
----------------------------------------------------------------
-- To use in your editor after or alongside your code for quick reference
-- Work in progress, mostly to be used as basis for further documnentation work, sorry for the errors and omissions
-- designed with atom - monokai one dark vivid as theme
-- https://gist.github.com/mxactvtd/bf3fb357a419c7f063b98dfd9a66cf78 - check for update, I keep updating this quite often atm
----------------------------------------------------------------
-- Some sources of Documentation --
-- https://tidalcycles.org/patterns.html
-- https://tidalcycles.org/functions.html
@patgarner
patgarner / test.cpp
Last active October 4, 2020 22:28
Example C++ class that demonstrates combined declaration and definition of class within single file.
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
class Test {
public:
Test(string name) : name(fixName(name)) {}
import SwiftUI
import PlaygroundSupport
// NOTE: this example currently only works with US-based coordinates
// constants
// New York
let latitude = 40.709335
let longitude = -73.956558
import SwiftUI
import SafariServices
import PlaygroundSupport
// lil news api
let apiURL = "https://api.lil.software/news"
struct News: Codable {
var articles: [Article]
}