Skip to content

Instantly share code, notes, and snippets.

// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "App",
products: [
// ...
],
@iband
iband / Editing.swift
Last active December 14, 2023 14:48 — forked from JadenGeller/Editing.swift
SwiftUI editing Binding for UITextView (UIResponder) firstResponder
import SwiftUI
import Dispatch
extension View {
// Warning: This will affect the layout of the view that's wrapped! :(
public func editing(_ isEditing: Binding<Bool>) -> some View {
EditingProxy(rootView: self, isEditing: isEditing)
}
}
@iband
iband / comands.sh
Last active July 4, 2016 10:38
Windows Bootcamp Install on macOS
//<Optional> Enable install from USB
//Backup the info.plist
sudo cp /Applications/Utilities/Boot\ Camp\ Assistant.app/Contents/Info.plist Desktop/Info.plist.bak
//Edit plist
sudo nano /Applications/Utilities/Boot\ Camp\ Assistant.app/Contents/Info.plist
//Add your Boot ROM Version: MBP41.00C1.B03 to
//DARequiredROMVersions
//Rename PreUSBBootSupportedModels to USBBootSupportedModels
//And add your Model Identifier: MacBookPro4,1 there.
//Save ^X, Y, Return
@iband
iband / gist:1712472
Created January 31, 2012 19:39
insertObject:atIndex:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSMutableArray *recents = [defaults objectForKey:RECENT_PHOTO_KEY];
if (!recents) recents = [NSMutableArray array];
if ([recents containsObject:clickedPhoto]) [recents removeObject:clickedPhoto]; //deleting object if we have one to keep the array of unique objects
[recents insertObject:clickedPhoto atIndex:0]; //inserting clicked photo to the beginning of the mutable array
[defaults setObject:recents forKey:RECENT_PHOTO_KEY]; //saving defaults
[defaults synchronize];
@iband
iband / VPN_AutoConnect_MacOS_X.scpt
Created March 31, 2011 10:45
Apple Script to enable VPN autoconnect on MacOS X
on idle
tell application "System Events"
tell current location of network preferences
set myConnection to the service "VPN" #rename as your VPN connection called
if myConnection is not null then
if current configuration of myConnection is not connected then
connect myConnection
end if
end if
end tell