Skip to content

Instantly share code, notes, and snippets.

View ValentinWalter's full-sized avatar
💫

Valentin ValentinWalter

💫
View GitHub Profile
@ValentinWalter
ValentinWalter / TextBuilder.swift
Created June 8, 2023 17:59
Build Text instances in a declarative manner, similar to regular views, from Text and Image. This ensures the font’s kerning, ligatures, and other properties are preserved across the entire text.
//
// TextBuilder.swift
//
//
// Created by Valentin Walter on 14.02.23.
//
import SwiftUI
/// Build Text instances in a declarative manner, similar to regular views, from
@ValentinWalter
ValentinWalter / make-gitignore.swift
Created October 17, 2021 13:14
A Script Command for Raycast. Creates a gitignore.
#!/usr/bin/swift
// Required parameters:
// @raycast.schemaVersion 1
// @raycast.title Make Gitignore
// @raycast.mode fullOutput
// Optional parameters:
// @raycast.icon 👻
// @raycast.argument1 { "type": "text", "placeholder": "Search Operating Systems, IDEs, or Programming Languages", "optional": false }
on convertRGBColorToHexValue(theRGBValues)
set theHexList to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"}
set theHexValue to ""
repeat with a from 1 to count of theRGBValues
set theCurrentRGBValue to (item a of theRGBValues) div 256
if theCurrentRGBValue is 256 then set theCurrentRGBValue to 255
set theFirstItem to item ((theCurrentRGBValue div 16) + 1) of theHexList
set theSecondItem to item (((theCurrentRGBValue / 16 mod 1) * 16) + 1) of theHexList
set theHexValue to (theHexValue & theFirstItem & theSecondItem) as string
end repeat
@ValentinWalter
ValentinWalter / QuadraticFormula.swift
Last active November 29, 2020 20:22
QuadraticFormula implemented in Swift
//
// QuadraticFormula.swift
// Convenience around the QuadraticFormula
//
// Created by Valentin Walter on 11/12/20.
//
import Foundation
/// Provides convenience around the [Quadratic Formula](https://en.wikipedia.org/wiki/Quadratic_formula).