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/bash | |
INPUT_FILE=$1 | |
START_LINE=`head -n1 $INPUT_FILE` | |
FIXED_TITLE=`echo $START_LINE | titlecase` | |
sed -i '' "1s/$START_LINE/$FIXED_TITLE/" $INPUT_FILE |
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
// Why does this work? | |
Menu { | |
Button { | |
print("applied") | |
} label: { | |
Text("Apply to All") | |
} | |
Button(role: .destructive) { |
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 | |
protocol DataSource<CellType>: AnyObject { | |
associatedtype CellType | |
func createCellFor(index: Int, reusing cell: CellType?) -> CellType | |
} | |
class ContainerView<CellType> where CellType: 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
public struct AlbumArtView: View { | |
var useContainerRelativeShape: Bool = false | |
public var body: some View { | |
// Option 1 | |
overlayView(for: 2.0) | |
// Option 2 | |
roundedCornerShape |
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
"CHOOSE_FIRETEAM_MEMBERS" = "Choose fireteam members from the drawer below to get started"; | |
"SEARCH_GUARDIANS" = "Search guardians…"; | |
"LOG_IN" = "Log In"; | |
"LOG_OUT" = "Log Out"; | |
"SWITCH_ACCOUNT" = "Switch Account"; | |
"LOG_OUT_QUESTION" = "Are you sure you want to log out?"; | |
"CANCEL" = "Cancel"; | |
"PLATFORM" = "Platform"; | |
"CLAN" = "Clan"; | |
"ENTER_CLAN" = "Enter Clan"; |
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
@propertyWrapper | |
public final class LayoutInvalidating<Value> where Value: Equatable { | |
public static subscript<EnclosingSelf>( | |
_enclosingInstance observed: EnclosingSelf, | |
wrapped wrappedKeyPath: ReferenceWritableKeyPath<EnclosingSelf, Value>, | |
storage storageKeyPath: ReferenceWritableKeyPath<EnclosingSelf, LayoutInvalidating> | |
) -> Value where EnclosingSelf: UIView { | |
get { | |
return observed[keyPath: storageKeyPath].stored |
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
function simrecord | |
if count $argv > /dev/null | |
set save_dir $argv | |
else | |
set save_dir ~/Downloads | |
end | |
pushd $save_dir | |
xcrun simctl io booted recordVideo --mask black --codec "h264" SimulatorRecording-(date +%F)-(date +%H.%M.%S).mov | |
popd |
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
public protocol ScalableValue: ExpressibleByFloatLiteral { | |
func scaled(by: Double) -> Self | |
} | |
public extension ScalableValue where Self: FloatingPoint { | |
func scaled(by constant: Double) -> Self { | |
return self * constant |
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 Foundation | |
protocol UnpackedProtocol { | |
associatedtype ObjectType | |
associatedtype PointType | |
var points: [PointType] { get set } | |
} |
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
//: A Cocoa based Playground to present user interface | |
import AppKit | |
import PlaygroundSupport | |
let nibFile = NSNib.Name("MyView") | |
var topLevelObjects : NSArray? | |
Bundle.main.loadNibNamed(nibFile, owner:nil, topLevelObjects: &topLevelObjects) | |
let views = (topLevelObjects as! Array<Any>).filter { $0 is NSView } |
NewerOlder