This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// VisionViewPlaygroundApp.swift | |
// VisionViewPlayground | |
// | |
// Created by Steven Troughton-Smith on 21/09/2023. | |
// | |
import SwiftUI | |
@main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
defaults read com.apple.finder CreateDesktop > /dev/null 2>&1 | |
enabled=$? | |
if [ "$1" = "off" ]; then | |
if [ $enabled -eq 1 ]; then | |
osascript -e 'tell application "Finder" to quit' | |
defaults write com.apple.finder CreateDesktop false | |
open -a Finder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension View { | |
func minimumPadding(edges: Edge.Set = .all, _ length: CGFloat = 8) -> some View { | |
GeometryReader { geo in | |
padding(.bottom, edges.contains(.bottom) ? max(length, geo.safeAreaInsets.bottom) : 0) | |
.padding(.top, edges.contains(.top) ? max(length, geo.safeAreaInsets.top) : 0) | |
.padding(.leading, edges.contains(.leading) ? max(length, geo.safeAreaInsets.leading) : 0) | |
.padding(.trailing, edges.contains(.trailing) ? max(length, geo.safeAreaInsets.trailing) : 0) | |
.ignoresSafeArea(edges: edges) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct NewStopView: View { | |
let stop: Model.Stop | |
var body: some View { | |
Text("New Layout").font(.title) | |
RouteLayout(spacing: 8) { | |
ForEach(stop.routes ?? []) { route in | |
RouteView(route: route) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./linelen_hist.sh src '*.c' | |
COLS COUNT | |
2 1317 ████████████████████████████████████████████████████████████▌ | |
4 583 ██████████████████████████▏ | |
6 500 ██████████████████████▎ | |
8 253 ███████████▊ | |
10 264 ████████████▊ | |
12 448 ████████████████████▋ | |
14 417 ███████████████████▌ | |
16 476 █████████████████████▍ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const edits = [ | |
[ | |
"node_modules/ts-invariant/package.json", | |
{ | |
type: "module", | |
exports: { | |
".": "./lib/invariant.esm.js", | |
"./process/index.js": "./process/index.js", | |
}, | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UITextField { | |
/// Add a trailing placeholder label that tracks the text as it changes | |
func addTrailingPlaceholder(_ placeholder: String) { | |
let label = UILabel() | |
label.text = placeholder | |
label.alpha = 0.3 | |
label.isHidden = true | |
let container = UIView() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// MIT License | |
/// | |
/// Copyright (c) 2021 Lukas Kubanek, Structured Path GmbH | |
/// | |
/// Permission is hereby granted, free of charge, to any person obtaining a copy | |
/// of this software and associated documentation files (the "Software"), to deal | |
/// in the Software without restriction, including without limitation the rights | |
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
/// copies of the Software, and to permit persons to whom the Software is | |
/// furnished to do so, subject to the following conditions: |
NewerOlder