Skip to content

Instantly share code, notes, and snippets.

View pjrobertson's full-sized avatar

Patrick Robertson pjrobertson

View GitHub Profile
@pjrobertson
pjrobertson / singletons properly
Created February 28, 2014 16:13
Shows how to properly make singletons/sharedInstances in objective-C, using a dispatch_once_t token
// MyObject.h
@interface MyObject : NSObject
+ (instancetype)sharedInstance;
@end
// MyObject.m
@implementation MyObject
@pjrobertson
pjrobertson / gist:df922342b0742ffaa1d0
Created July 10, 2014 06:40
Django logger settings
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
},
'require_debug_true': {
'()': 'django.utils.log.RequireDebugTrue'
}
Process: Quicksilver [382]
Path: /Applications/Quicksilver.app/Contents/MacOS/Quicksilver
Identifier: com.blacktree.Quicksilver
Version: 1.2.0 (400D)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Quicksilver [382]
User ID: 501
Date/Time: 2014-08-09 03:06:08.605 +0100
Process: Quicksilver [8639]
Path: /Applications/Quicksilver.app/Contents/MacOS/Quicksilver
Identifier: com.blacktree.Quicksilver
Version: 1.2.0 (400D)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Quicksilver [8639]
User ID: 501
Date/Time: 2014-08-13 23:59:49.067 -0700
@pjrobertson
pjrobertson / gist:42390f90857e49dbe8dd
Created November 2, 2014 20:42
Counties list of ebay
Avon
Bedfordshire
Berkshire
Bristol
Buckinghamshire
Cambridgeshire
Cheshire
Cleveland
Cornwall
Cumbria
@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
+// 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