This file contains hidden or 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 hidden or 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 groovy | |
def m = [ | |
nephew1:[name:"Huey", age:10], | |
nephew2:[name:"Dewey", age:12], | |
nephew3:[name:"Louie", age:13] | |
] | |
println m.collectEntries { [(it.key) : (it.value.name)] } | |
// [nephew1:Huey, nephew2:Dewey, nephew3:Louie] |
This file contains hidden or 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
set content to missing value | |
display dialog ¬ | |
"Which contents do you want to insert?" buttons {"Cancel", "Complete Buffer", "Currently visible content"} ¬ | |
default button ¬ | |
"Currently visible content" cancel button ¬ | |
"Cancel" with title ¬ | |
"Copy contents from Terminal.app" giving up after 10 | |
if button returned of result is "Complete Buffer" then |
This file contains hidden or 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 hidden or 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 hidden or 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/sbin/dtrace -s | |
#pragma D option quiet | |
pid$target:mysqld:*mysql_parse*:entry | |
{ | |
printf("[%Y] %s\n", walltimestamp, copyinstr(arg1)); | |
} |
This file contains hidden or 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
require 'uri' | |
# without force_encoding ruby will throw an | |
# "invalid byte sequence in US-ASCII" exception | |
# when running this script from Automator | |
input = ARGF.read.force_encoding("UTF-8") | |
# scan for JIRA Ticket IDs like MYPROJECT-42 | |
input.scan(/([A-Z]+\-[0-9]+)/).each do |id| | |
url = "https://<your JIRA server>/browse/#{id[0]}" |
This file contains hidden or 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
Progress.totalUnitCount = 100 | |
Progress.completedUnitCount = 0 | |
Progress.description = "Testing progress" | |
Progress.additionalDescription = "foobar" | |
for(i = 0; i < Progress.totalUnitCount; i++) { | |
Progress.description = "Item " + i + " of " + Progress.totalUnitCount | |
delay(1) | |
Progress.completedUnitCount = i | |
} |