The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
 - Revised date: March 15th 2016
 - Revised by Bytes Unlimited : June 14th 2017
 
| ------------------------------------------------ | |
| -- Settings Start: Change these as needed | |
| global gDest | |
| set gDest to "/Volumes/MacPhotos/Pictures/ExportAlbums/" as POSIX file as text -- the destination folder (use a valid path) | |
| global gLogFile | |
| set gLogFile to gDest & "ExportAlbumToFolders.log" | |
| global gKeywordOnSuccess | |
| set gKeywordOnSuccess to "exported" | 
| func jpegDataFrom(image:NSImage) -> Data { | |
| let cgImage = image.cgImage(forProposedRect: nil, context: nil, hints: nil)! | |
| let bitmapRep = NSBitmapImageRep(cgImage: cgImage) | |
| let jpegData = bitmapRep.representation(using: NSBitmapImageRep.FileType.jpeg, properties: [:])! | |
| return jpegData | |
| } | 
| // Swift enums cannot be declared with a rawValue if they have associated values | |
| // like good ol' Amargasaurus has. Using String(describing: dino) on a case with | |
| // associated also includes the values, but works fine on unassociated cases. | |
| // Mirror(reflecting: dino) can extract the name of an associated case, but is | |
| // nil for unassociated cases. Our hero ?? swoops in to save the day! | |
| enum Sauropoda { | |
| case Amargasaurus(things: Int64, hasOtherThing: Bool?) | |
| case Antetonitrus | |
| // ... | 
| import dateMixin from './mixins/date'; | |
| // Globally | |
| Vue.mixin(dateMixin); | 
| /** | |
| * MacEditorTextView | |
| * Copyright (c) Thiago Holanda 2020-2021 | |
| * https://bsky.app/profile/tholanda.com | |
| * | |
| * (the twitter account is now deleted, please, do not try to reach me there) | |
| * https://twitter.com/tholanda | |
| * | |
| * MIT license | |
| */ | 
| // The SwiftUI Lab | |
| // Website: https://swiftui-lab.com | |
| // Article: https://swiftui-lab.com/alignment-guides | |
| import SwiftUI | |
| struct ContentView: View { | |
| @State var position: Int = 0 | |
| var body: some View { | 
| import Foundation | |
| import SwiftUI | |
| extension Published:Decodable where Value:Decodable { | |
| public init(from decoder: Decoder) throws { | |
| let decoded = try Value(from:decoder) | |
| self = Published(initialValue:decoded) | |
| } | |
| } | 
| import SwiftUI | |
| #if os(macOS) | |
| public typealias Font = NSFont | |
| public typealias FontDescriptor = NSFontDescriptor | |
| #else | |
| public typealias Font = UIFont | |
| public typealias FontDescriptor = UIFontDescriptor | |
| #endif | 
| import SwiftUI | |
| import WebKit | |
| import Combine | |
| class WebViewData: ObservableObject { | |
| @Published var loading: Bool = false | |
| @Published var scrollPercent: Float = 0 | |
| @Published var url: URL? = nil | |
| @Published var urlBar: String = "https://nasa.gov" | |