James Porter
- Architecture-style
- x,y,z
import SwiftUI | |
// fuck it this should be fine-ish (as on main thread)? | |
fileprivate var lastStartPoint: CGPoint? | |
extension View { | |
func quickTap(action: @escaping () -> Void) -> some View { | |
gesture(DragGesture(minimumDistance: 0).onChanged { value in | |
if value.startLocation == lastStartPoint { | |
function dl(url: string, title: string, idx: number): Promise<boolean> { | |
const file = fs.createWriteStream(`./downloads/${pad(idx)}-${title}.mp4`) | |
return new Promise((resolve, reject) => { | |
axios({ | |
method: "get", | |
url, | |
responseType: "stream", | |
}).then((response) => { | |
response.data.pipe(file) | |
response.data.on("end", () => { |
import SwiftUI | |
struct ContentView: View { | |
@State var query = "" | |
var body: some View { | |
NavigationView { | |
ScrollView { | |
LazyVStack { | |
ForEach(0..<100, id: \.self) { n in | |
HStack { |
import SwiftUI | |
enum Config { | |
static let zoomRange: ClosedRange<CGFloat> = 0.05...1.0 | |
} | |
extension View { | |
func zoomable(scale: Binding<CGFloat>) -> some View { | |
ZoomableView(scale: scale) { | |
self |
{ | |
"ios": "react-native run-ios", | |
"ios:iPad": "react-native run-ios --simulator=\"iPad Pro (11-inch) (3rd generation)\"", | |
"ios:iPhone8": "react-native run-ios --simulator=\"iPhone 8 Plus\"", | |
"ios:iPhone11": "react-native run-ios --simulator=\"iPhone 11 Pro Max\"" | |
} |
<key>UISupportedInterfaceOrientations</key> | |
<array> | |
<string>UIInterfaceOrientationPortrait</string> | |
</array> | |
<key>UISupportedInterfaceOrientations~ipad</key> | |
<array> | |
<string>UIInterfaceOrientationPortrait</string> | |
<string>UIInterfaceOrientationPortraitUpsideDown</string> | |
<string>UIInterfaceOrientationLandscapeLeft</string> | |
<string>UIInterfaceOrientationLandscapeRight</string> |
import SwiftUI | |
fileprivate struct SizeSpecKey: EnvironmentKey { | |
static let defaultValue = SizeSpec(size: CGSize.zero) | |
} | |
extension EnvironmentValues { | |
var sizeSpec: SizeSpec { | |
get { self[SizeSpecKey.self] } |
import Head from "next/head"; | |
import { VRCanvas, DefaultXRControllers, useXR, Hover, Select } from "react-xr"; | |
import { useFrame } from "react-three-fiber"; | |
import { useState, useRef } from "react"; | |
function Box({ | |
size = 1, | |
position = [0, 0, 0], | |
}: { | |
size?: number; |
import SwiftUI | |
class NavState: ObservableObject { | |
@Published var modalActive = false | |
@Published var navDepth = 0 | |
} | |
struct ContentView: View { | |
@EnvironmentObject var navState: NavState |