Skip to content

Instantly share code, notes, and snippets.

View boehs's full-sized avatar
🐕‍🦺
woof

Evan Boehs boehs

🐕‍🦺
woof
View GitHub Profile
@boehs
boehs / imagexss.svg
Last active February 16, 2024 04:17
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@boehs
boehs / UniFFI.md
Last active December 20, 2023 07:48
A little guide to UniFFI for iOS (using Proc macros)

Hi all! My app, Love Your Music, needs a cross platform backend shared between a swift and kotlin codebase. UniFFI has been an absolute joy to use, but unfortunately the setup process is a little bit poorly documented. No problem! I got you <3. This tutorial assumes you have a file structure like

Note

Why Rust × Swift? A common use for rust is FFI, which we are actually doing right here anyway! But if you can FFI to Swift, you can FFI to anywhere. Cross platform apps writen in native code (e.g. apps with a Kotlin counterpart) benefit greatly from shared libraries and UniFFI. In addition, the Rust community is significantly larger, and so it's very likely you'll find crates that are more battletested, more featureful, higher performance, more documented, or even nonexistant in Swift.

app/
app.xcodeproj/
app.xcworkspace/
myCrate/
@boehs
boehs / Marquee.swift
Created December 1, 2023 18:46
SwiftUI marquee text
//
// Marquee.swift
// lym
//
// Created by Evan Boehs on 11/30/23.
//
import SwiftUI
public struct MarqueeText : View {
@boehs
boehs / MastodonLinker.swift
Last active March 19, 2024 20:39
Open Mastodon URL iOS SwiftUI
struct MastodonLinker {
var instance: String
var user: String
@Environment(\.openURL) private var openURL
func openMastodonLink() {
let urls = [
"opener://x-callback-url/show-options?url=https%3A%2F%2F\(instance)%2F\(user)",
"ivory://\(instance)/@\(user)",
"icecubesapp://\(instance)/@\(user)",
@boehs
boehs / fr24.ts
Created October 30, 2023 15:56
FlightRadar24 scrapper for tracking specific flights (used in 2023 Lewiston, Maine Shootings Wikipedia article)
//[...document.querySelectorAll('a[data-flight-duration]')].map(e => e.getAttribute('data-flight-hex'))
interface FlightPlaybackPoints {
latitude: number
longitude: number
timestamp: number
}
type FlightPlaybackResponse = {
flight: {
@boehs
boehs / parser.ts
Created September 7, 2023 13:28
athletic.net times to sheet (for desmos)
[...temp1.querySelectorAll('[_ngcontent-ng-c2304734222]')].map(e => e.textContent).filter(t => t.match(/^\d\d:\d\d/)).map((t,i) => {
let [m,s] = t.split(':')
return i + ',' + (Number(m) + (Number(s) * (100/60) / 100))
}).join('\n')
@boehs
boehs / instagram-export-parser.ts
Created August 27, 2023 02:55
instagram data export profile parser
[...document.querySelectorAll('a')].map(a => a.textContent).sort().join('\n')
@boehs
boehs / owid.ts
Created July 5, 2023 17:25
OWID helper
let global: {
[entity: string]: {
[year: number]: {
[col: string]: string
}
}
} = {}
async function pCSV(fName: string) {
const f: string[][] = (await Bun.file(fName + ".csv").text()).split("\n").map(l => l.split(','));
@boehs
boehs / file.js
Last active June 23, 2023 02:55
(quizlet|vocabulary.com) to seperated words
let words = document.querySelectorAll('.SetPageTerm-wordText');
[...document.querySelectorAll('.SetPageTerm-definitionText')].map((def,index) => def.textContent + " " + words[index].textContent).join('\n')
let weights = Object.fromEntries("IJ​IJ ij​ij LJ​LJ Lj​Lj lj​lj NJ​NJ Nj​Nj nj​nj DZ​DZ Dz​Dz dz​dz Rs​₨ No​№ SM​℠ TEL​℡ TM​™ FAX​℻ ll​Ⅱ II​Ⅱ III​Ⅲ IV​Ⅳ VI​Ⅵ VII​Ⅶ VIII​Ⅷ IX​Ⅸ XI​Ⅺ XII​Ⅻ ii​ⅱ iii​ⅲ iv​ⅳ vi​ⅵ vii​ⅶ viii​ⅷ ix​ⅸ xi​ⅺ xii​ⅻ hPa​㍱ da​㍲ AU​㍳ bar​㍴ oV​㍵ pc​㍶ pA​㎀ nA​㎁ mA​㎃ kA​㎄ KB​㎅ MB​㎆ GB​㎇ cal​㎈ kcal​㎉ pF​㎊ nF​㎋ mg​㎎ kg​㎏ Hz​㎐ kHz​㎑ MHz​㎒ GHz​㎓ THz​㎔ ml​㎖ dl​㎗ kl​㎘ fm​㎙ nm​㎚ mm​㎜ cm​㎝ km​㎞ Pa​㎩ kPa​㎪ MPa​㎫ GPa​㎬ rad​㎭ ps​㎰ ns​㎱ ms​㎳ pV​㎴ nV​㎵ mV​㎷ kV​㎸ MV​㎹ pW​㎺ nW​㎻ mW​㎽ kW​㎾ MW​㎿ Bq​㏃ cc​㏄ cd​㏅ dB​㏈ db​ȸ ls​ʪ Is​ʪ lz​ʫ Iz​ʫ Gy​㏉ ha​㏊ HP​㏋ in​㏌ KK​㏍ KM​㏎ kt​㏏ lm​㏐ ln​㏑ log​㏒ lx​㏓ mb​㏔ mil​㏕ mol​㏖ PH​㏗ PPM​㏙ PR​㏚ sr​㏛ Sv​㏜ Wb​㏝ ff​ff fi​fi fl​fl ffi​ffi ffl​ffl st​st WC​🅏 MC​🅪 MD​🅫 NUL​␀ SOH​␁ STX​␂ ETX​␃ EOT​␄ ENQ​␅ ACK​␆ BEL​␇ BS​␈ HT​␉ LF​␊ VT​␋ FF​␌ CR​␍ DLE​␐ DC1​␑ DC2​␒ DC3​␓ DC4​␔ NAK​␕ SYN​␖ ETB​␗ CAN​␘ EM​␙ SUB​␚ ESC​␛ FS​␜ GS​␝ RS​␞ US​␟ AA​Ꜳ aa​ꜳ AE​Æ ae​æ AO​Ꜵ ao​ꜵ au​ꜷ AV​Ꜹ av​ꜹ AY​Ꜽ ay​ꜽ OE​Œ oe​œ OO​Ꝏ oo​ꝏ CE​₠ ue​ᵫ VY​Ꝡ vy​ꝡ 10​⒑ 11​⒒ 12​⒓ 13​⒔ 14​⒕ 15​⒖ 16​⒗ 17​⒘ 18​⒙ 19​⒚ 20​⒛ qp​ȹ ts​ʦ fff​🝝 sss​