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
cd ~/Desktop / PlanetaryHoursSwift | |
sudo ls -l | |
sudo rm -rf .git | |
sudo ls -a | |
git init | |
git add . | |
git commit -m "Initial commit" | |
git remote add origin https: // github.com/theoknock/PlanetaryHoursSwift.git | |
git push -u origin 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
import SwiftUI | |
import CoreLocation | |
struct ContentView: View { | |
@StateObject private var locationManager = LocationManager() | |
@State private var sunrise: Date = Date().addingTimeInterval(TimeInterval(TimeZone.current.secondsFromGMT(for: Date()))) | |
@State private var sunset: Date = Date().addingTimeInterval(TimeInterval(TimeZone.current.secondsFromGMT(for: Date()))) | |
@State private var nextDaySunrise: Date = Date().addingTimeInterval(TimeInterval(TimeZone.current.secondsFromGMT(for: Date()))) | |
@State private var hours: [PlanetaryHourSegmenter.PlanetaryHourSegment] = [] | |
@State private var longitudes: [LongitudeSegmenter.Segment] = [] |
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 | |
import UniformTypeIdentifiers | |
struct TextFile: FileDocument { | |
static var readableContentTypes: [UTType] { [.plainText] } | |
var text = "" | |
init(initialText: String = "") { | |
text = initialText |
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 ContentView: View { | |
@Binding var document: TextFile | |
var body: some View { | |
HStack { | |
TextEditor(text: $document.text) | |
} | |
} |
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 | |
import Speech | |
import AVFoundation | |
import Combine | |
import Observation | |
@Observable class SpeechRecognizer: NSObject, SFSpeechRecognizerDelegate { | |
var transcription: String = "Transcription" | |
var isTranscribing: Bool = false |
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
""" | |
Install the Google AI Python SDK | |
$ pip install google-generativeai | |
See the getting started guide for more information: | |
https://ai.google.dev/gemini-api/docs/get-started/python | |
""" | |
import os |
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 | |
import Speech | |
import AVFoundation | |
import Combine | |
import Observation | |
@Observable | |
class SpeechRecognizer { | |
var transcription: String = "" | |
var isTranscribing: Bool = false |
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 CoreFoundation | |
import Foundation | |
var a = 3 | |
var b = 7 | |
var c = 5 | |
var d = 10 | |
func measureTime(for expression: () -> Void, iterations: Int) -> Double { | |
var totalTime: CFAbsoluteTime = 0 |
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
sudo pico ~/scripts/connect_hotspot.applescript | |
sudo pico ~/scripts/connect_hotspot.zsh | |
chmod +x ~/scripts / connect_hotspot.zsh | |
sudo pico ~/Library/LaunchAgents/com.user.connecthotspot.plist | |
networksetup -listallnetworkservices | |
tail -f ~/connect_hotspot.log |
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 | |
typealias PredicateFunction = (UInt) -> UInt | |
typealias PredicateFunctionPointer = UnsafeMutablePointer<PredicateFunction> | |
let swapPointers: () -> Void = { | |
var funcA: PredicateFunction = { predicate in | |
print("funcA returned", terminator: " ") | |
return predicate | |
} |
NewerOlder