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
#!/usr/bin/env swift | |
// Run this command line tool as a dynamic script or compile a binary | |
// using the following command: | |
// swiftc -sdk `xcrun --show-sdk-path` LocateMe.swift | |
import Cocoa | |
import CoreLocation | |
extension String { |
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
#!/usr/bin/env swift | |
import Foundation | |
let args = Process.arguments | |
if (args.count != 2) { | |
print("usage: \(args[0].lastPathComponent) <file>\n") | |
exit(-1) | |
} |
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
#!/usr/bin/env swift | |
import Foundation | |
let args = Process.arguments | |
if (args.count != 2) { | |
print("usage: \(args[0]) <file>\n") | |
exit(-1) | |
} |
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 | |
if let bundleURL = NSBundle.mainBundle().URLForResource("Settings", withExtension: "bundle") { | |
NSUserDefaults.registerDefaults(settingsBundleURL: bundleURL) | |
} | |
extension NSUserDefaults { | |
static func registerDefaults(#settingsBundleURL: NSURL) { | |
if let rootDict = NSDictionary(contentsOfURL: settingsBundleURL.URLByAppendingPathComponent("Root.plist")) { | |
var defaults: NSUserDefaults? |
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 | |
set document_name to "Safari Links" | |
set row_topic to "Links" | |
set browser_url to missing value | |
tell application "Safari" | |
set browser_url to URL of first document |
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
var app = Application.currentApplication() | |
app.includeStandardAdditions = true | |
var itunes = Application("iTunes") | |
var url = "http://localhost:9200/itunes/track/" | |
var lib = itunes.sources["Library"] | |
var tracks = lib.tracks() |
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
#!/usr/bin/env bash | |
if [ $# != 2 ]; then | |
echo `basename $0`" <src file> <dst file>" | |
exit | |
fi | |
xattr -w "com.apple.metadata:kMDItemLatitude" $(mdls -name kMDItemLatitude "$1" | awk '{print $3}' | sed s/\"//g) "$2" | |
xattr -w "com.apple.metadata:kMDItemLongitude" $(mdls -name kMDItemLongitude "$1" | awk '{print $3}' | sed s/\"//g) "$2" |
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
#!/usr/bin/env bash | |
if [ $# != 2 ]; then | |
echo `basename $0`" <src file> <dst file>" | |
exit | |
fi | |
SetFile -d '$(GetFileInfo -m "$1")' "$2" |
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 | |
set content to missing value | |
tell application "Safari" | |
try | |
set content to text of first document | |
end try | |
end tell |
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
protocol ServiceLocatorType { | |
func getService<T>(type: T.Type) -> T | |
} | |
public final class ServiceLocator: ServiceLocatorType { | |
public static let instance = ServiceLocator() | |
private var serviceRegistry: [String:Any] = [:] |
NewerOlder