Skip to content

Instantly share code, notes, and snippets.

View slunsford's full-sized avatar

Sean Lunsford slunsford

View GitHub Profile
@gruber
gruber / Split Tabs to New Window.scpt
Last active April 16, 2024 20:52
An AppleScript for Safari to move all tabs in the frontmost window, from the current tab to the rightmost (last) tab, to a new window.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
(*
Original script: John Gruber (https://daringfireball.net/linked/2023/12/05/an-applescript-for-safari-split-tabs-to-new-window)
Much more elegant version: Leon Cowle (https://github.com/leoncowle)
Even more elegant version: https://stackoverflow.com/questions/54066100/applescript-to-split-safari-tabs-into-new-window/54089865#54089865
Worth a warning: "moving" tabs with this script doesn't actually move them like
drag-and-drop does. The tabs "moved" by this script will reload in the new window,
@christianselig
christianselig / Locale+SFSymbol.swift
Created September 3, 2021 21:54
Returns an SF Symbol currency image that match's the device's current locale, for instance dollar in North America, Indian rupee in India, etc.
extension Locale {
/// Returns an SF Symbol currency image that match's the device's current locale, for instance dollar in North America, Indian rupee in India, etc.
func currencySFSymbol(filled: Bool, withConfiguration configuration: UIImage.Configuration? = nil) -> UIImage {
// Default currency symbol will be the Animal Crossing Leaf coin 􁂬 to remain impartial to any specific country
let defaultSymbol = UIImage(systemName: "leaf.circle\(filled ? ".fill" : "")")!
guard let currencySymbolName = currencySymbolNameForSFSymbols() else { return defaultSymbol }
let systemName = "\(currencySymbolName).circle\(filled ? ".fill" : "")"
return UIImage(systemName: systemName, withConfiguration: configuration) ?? defaultSymbol