Skip to content

Instantly share code, notes, and snippets.

View pjrobertson's full-sized avatar

Patrick Robertson pjrobertson

View GitHub Profile
@pjrobertson
pjrobertson / Show_Character_Palette
Created April 25, 2012 10:42
Show Character Palette script for OS X
property querylist : {"CharacterPalette"}
property app_is_up : missing value
set app_is_up to false
set frontapp to getFrontApplication()
repeat with i in querylist
set the_ps to paragraphs of (do shell script "/bin/ps -acx")
tid("/")
repeat with _line in the_ps
if _line is "" then
else
@pjrobertson
pjrobertson / Toggle_Keyboard_Viewer
Created April 25, 2012 10:43
Toggle Keyboard Viewer for OS X
tell application "System Events"
if exists (process "Keyboard Viewer") then
click (process "Keyboard Viewer"'s window 1's buttons whose subrole is "AXCloseButton")
else
do shell script "/usr/local/bin/keyboardViewer"
end if
end tell
+// Contents of sourceFiles are SBObjects (i.e. it's technically an SBElementArray)
+ NSMutableArray *sourceFiles = [[NSMutableArray alloc] initWithCapacity:[files count]];
+ for (NSString *path in files) {
+ [sourceFiles addObject:[[finder items] objectAtLocation:path]];
+ }
+ FinderItem *destinationItem = [[finder items] objectAtLocation:destination];
+
+ if (copy) {
+ [(SBObject *)sourceFiles duplicateTo:destinationItem replacing:NO routingSuppressed:NO exactCopy:YES];
+ } else {
a = ['a','b','c','d']
b = ['1','2','3','b']
for aLet in a:
for bLet in b:
if aLet is bLet:
print 'they are the same!'
- (void)setObjectValue:(id)value {
if ([value isKindOfClass:[QSObject class]]) {
[self setRepresentedObject:value];
}
}
@pjrobertson
pjrobertson / gist:4040736
Created November 8, 2012 18:52
QS 64 bit plugins (**)
1Password Plugin **
Abracadabra Triggers
AcidSearch Queries
Address Book Plugin **
AirPort Module
Apple Mail Plugin **
Automator Plugin **
BBEdit Module
Backpack Module
Bluetooth Module
- (NSDictionary *)infoRecord {
NSString *path = [self validSingleFilePath];
if (!path)
return nil;
NSDictionary *dict;
if (dict = [self objectForCache:@"QSItemInfoRecord"])
return dict;
/* Try to get information for this file */
@pjrobertson
pjrobertson / gist:4120859
Created November 20, 2012 20:30
Plex Media Server libxml plugin crash
Process: Python [86444]
Path: /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python
Identifier: Python
Version: 2.5.6 (2.5.6a0)
Code Type: X86 (Native)
Parent Process: Plex Media Server [86443]
User ID: 501
PlugIn Path: /Users/USER/Library/Application Support/Plex Media Server/*/Framework.bundle/Contents/Resources/Platforms/MacOSX/i386/Frameworks/libxml2.2-osx.dylib
PlugIn Identifier: libxml2.2-osx.dylib
$ ls -l /System/Library/Frameworks/Python.framework/Versions
drwxr-xr-x 6 root wheel 204 21 Jun 00:23 2.3
drwxr-xr-x 11 root wheel 374 2 Nov 07:20 2.5
drwxr-xr-x 11 root wheel 374 2 Nov 07:21 2.6
drwxr-xr-x 11 root wheel 374 2 Nov 07:21 2.7
lrwxr-xr-x 1 root wheel 3 22 Jul 03:25 Current -> 2.7
$ python
Python 2.7.2 (default, Jun 20 2012, 16:23:33)
patrick$ cat a.php
<?php
echo (TRUE ? "a" : (TRUE ? "b" : "c"))."\n";
?>
patrick$ php a.php
a