A collection of all of the various options and styles available to you if you'd like to format data into string on iOS 15.
See every option in detail at fuckingformatstyle.com or goshdarnformatstyle.com.
//---------------------- | |
// Gaffer On Games | |
// https://gafferongames.com/post/fix_your_timestep/ | |
//---------------------- | |
// Fixed delta time | |
// If delta time match the display refresh rate, and you can ensure that your update loop takes less than one frame worth of real time. | |
double t = 0.0; | |
double dt = 1.0 / 60.0; | |
while (!quit) { |
#!/usr/bin/env sh | |
# usage: sh ./generate-target-dependencies.sh | dot -Tsvg -o target-graph.svg | |
packages=`swift package describe --type json` | |
targets=`echo $packages | jq '.targets'` | |
target_names=`echo $targets | jq -r '.[] | .name'` | |
body="" | |
template=`cat <<EOF | |
digraph DependenciesGraph { |
A collection of all of the various options and styles available to you if you'd like to format data into string on iOS 15.
See every option in detail at fuckingformatstyle.com or goshdarnformatstyle.com.
Swift’s type system supports a number of different ways of taking a function or type and abstracting it. Usually, this is done by adding a generic parameter and an associated set of constraints. Similarly, a function that takes a particular type of argument can be abstracted to any number of those arguments by making it variadic with triple-dot (...) syntax. Today, both of these features are permitted separately: you can define a generic function that takes a variable number of arguments, such as
func debugPrint<T>(_ items: T...)
where T: CustomDebugStringConvertible
{
for (item: T) in items {
stdout.write(item.debugDescription)
swiftc main.swift -emit-module-path main.swiftmodule -emit-executable -enable-private-imports -Xfrontend -enable-implicit-dynamic
./main
-> prints From original bar()
swiftc -emit-library inject.swift -o inject.dylib -I . -Xlinker -undefined -Xlinker suppress -Xlinker -flat_namespace -Xfrontend -disable-access-control
DYLD_INSERT_LIBRARIES=inject.dylib ./main
-> prints From replacement bar()
-Xfrontend -enable-implicit-dynamic
removes you from having to add dynamic
to everything you want to be replacableextension CVPixelBuffer { | |
public static func from(_ data: Data, width: Int, height: Int, pixelFormat: OSType) -> CVPixelBuffer { | |
data.withUnsafeBytes { buffer in | |
var pixelBuffer: CVPixelBuffer! | |
let result = CVPixelBufferCreate(kCFAllocatorDefault, width, height, pixelFormat, nil, &pixelBuffer) | |
guard result == kCVReturnSuccess else { fatalError() } | |
CVPixelBufferLockBaseAddress(pixelBuffer, []) | |
defer { CVPixelBufferUnlockBaseAddress(pixelBuffer, []) } |
#pragma once | |
// #include <imgui.h> | |
// #include <examples/imgui_impl_glfw.h> | |
// #include <examples/imgui_impl_opengl3.h> | |
#include <stb_image.h> | |
#include <gl3w/GL/gl3w.h> | |
#include <GLFW/glfw3.h> | |
#include <cmath> | |
#include <cstdio> | |
#include <cfloat> |
// Windows | |
// g++ *.cpp -o vulkan -lSDL2main -lSDL2 -lvulkan-1 | |
// Linux | |
// g++ *.cpp -o vulkan -lSDL2main -lSDL2 -lvulkan | |
// https://vulkan-tutorial.com/ | |
#include <iostream> | |
using namespace std; | |
#include <SDL2/SDL.h> |
My hopes for deployable artifacts:
// The point of this prototype is to prove that we can generate efficient code | |
// for single-element insertion and deletion on a statically-sized array, with | |
// stable types for the end products i.e., | |
// | |
// type(of: a.removing(at: i).inserting(x, at: j)) == type(of: a) | |
// | |
// and | |
// | |
// type(of: a.inserting(x, at: j).removing(at: i)) == type(of: a) |