Skip to content

Instantly share code, notes, and snippets.

View tom-ludwig's full-sized avatar
:octocat:
114% Productivity

Tom Ludwig tom-ludwig

:octocat:
114% Productivity
View GitHub Profile
@tom-ludwig
tom-ludwig / Webview.swift
Created August 24, 2021 18:47 — forked from joshbetz/Webview.swift
A simple SwiftUI Webview
import SwiftUI
import WebKit
struct ContentView: View {
var body: some View {
Webview(url: URL(string: "https://google.com")!)
}
}
struct Webview: UIViewRepresentable {
@tom-ludwig
tom-ludwig / FuzzySearch.swift
Created November 1, 2023 14:46
Fuzzy Search in Swift
import Foundation
import CollectionConcurrencyKit
enum FuzzySearch {
/// Searches an array of view models for occurrences of a fuzzy search query.
///
/// This function takes a fuzzy search `query` and an array of `URL`s, and returns a new array that contains only
/// those url's that match the query.
/// The function uses the `score` function to calculate a score for each url and
/// includes only those url's whose scores are greater than 0.0.
@tom-ludwig
tom-ludwig / FuzzySearch.swift
Created February 6, 2024 17:40
This Fuzzy Search algorithm offers both speed and ease of understanding. A significant advantage is its capability to not only provide the score but also the range of matching characters.
import Foundation
/// FuzzySearchCharacters is used to normalise strings
struct FuzzySearchCharacter {
let content: String
// normalised content is referring to a string that is case- and accent-insensitive
let normalisedContent: String
}
/// FuzzySearchString is just made up by multiple characters, similar to a string, but also with normalised characters
@tom-ludwig
tom-ludwig / rust-xp-01-s3.rs
Created October 11, 2024 13:18 — forked from jeremychone/rust-xp-01-s3.rs
Rust Quick Example to connect to S3 and Minio bucket server
#![allow(unused)] // silence unused warnings while exploring (to comment out)
use std::{error::Error, str};
use s3::bucket::Bucket;
use s3::creds::Credentials;
use s3::region::Region;
use s3::BucketConfiguration;
// Youtube Walkthrough - https://youtu.be/uQKBW8ZgYB8