Skip to content

Instantly share code, notes, and snippets.

set theProcessName to "iOS Simulator"
set theWindowNumber to 1
tell application "System Events"
tell process theProcessName
activate
tell window theWindowNumber
set thePosition to position
set theSize to size
end tell
#!/usr/bin/env xcrun swift
import Foundation
let kDelayUSec : useconds_t = 500_000
func DragMouse(from p0: CGPoint, to p1: CGPoint) {
let mouseDown = CGEventCreateMouseEvent(nil, .LeftMouseDown, p0, .Left)
let mouseDrag = CGEventCreateMouseEvent(nil, .LeftMouseDragged, p1, .Left)
let mouseUp = CGEventCreateMouseEvent(nil, .LeftMouseUp, p1, .Left)
@pwc3
pwc3 / keybase.md
Created August 14, 2014 15:57
Verifying myself for Keybase.io

Keybase proof

I hereby claim:

  • I am pwc3 on github.
  • I am pwc (https://keybase.io/pwc) on keybase.
  • I have a public key whose fingerprint is 54D6 83ED A697 10D0 9197 0AC4 EB1D 31E1 F05D EB34

To claim this, I am signing this object:

#import <Foundation/Foundation.h>
#import <stdio.h>
@interface ExampleObject : NSObject
// BLOCK AS A PROPERTY
// -------------------
//
// @property (copy, ...) return_type (^block_name)(parameter_types);
//
@pwc3
pwc3 / swift-repl
Last active August 29, 2015 14:02
#!/usr/bin/env bash
/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
tell application "Xcode"
set _workspace to active workspace document
set _workspaceFile to file of _workspace
end tell
tell application "Finder"
set _posixTargetPath to quoted form of POSIX path of _workspaceFile
end tell
tell application "Xcode"
tell application "System Events"
tell process "Tweetbot"
repeat
-- need to put this in a try block as it sometimes fails
try
-- loop over all of the windows
repeat with _window in windows
-- if the title isn't "Main Window"...
if title of _window is not "Main Window" then
-- ... close it by performing AXPress on button 1 (which corresponds to the red stoplight button)
set appleID to "ENTER YOUR APPLE ID HERE"
activate application "Xcode"
tell application "System Events"
tell process "Xcode"
-- open the preferences dialog
click menu item "Preferences…" of menu "Xcode" of menu bar 1
-- find and select the Accounts tab
@pwc3
pwc3 / SkypeMenuUpdater_Output.txt
Created October 8, 2013 05:32
This is the output I'm getting from my SkypeMenuUpdater.rb script. This is on a computer running Mac OS X 10.8.5 with FScript 2.1 and Skype 6.7.60.373. I was able to run a script (https://gist.github.com/1170175) to successfully inject F-Script into Safari. This leads me to think that there is an issue with Skype.
$ SkypeMenuUpdater.rb
GNU gdb 6.3.50-20050815 (Apple version gdb-1824) (Wed Feb 6 22:51:23 UTC 2013)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".
(gdb) Attaching to process 5393.
Reading symbols for shared libraries . done
@pwc3
pwc3 / com.paulcalnan.pbcopy.plist
Created September 30, 2013 05:31
LaunchDaemon enabling copying to the pasteboard from a remote host.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.paulcalnan.pbcopy</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/pbcopy</string>
</array>