Skip to content

Instantly share code, notes, and snippets.

@scottjacksonx
scottjacksonx / UIView+RecursiveSubviews.h
Last active December 30, 2015 10:59
Recursively walks a UIView's subview hierarchy looking for a view of the given kind. Any time we find a view of that kind, we execute the given block, passing in the view we found.
//
// UIView+RecursiveSubviews.h
//
// Created by Scott Jackson on 6/12/2013.
//
#import <UIKit/UIKit.h>
@interface UIView (RecursiveSubviews)
@scottjacksonx
scottjacksonx / UIApplication+StatusBarForegroundColor.m
Last active December 24, 2015 13:59
This is a category on UIApplication that (as of iOS 7) lets you set the status bar foreground color (which is used as the color for things like the system time, signal strength indicators, and "alarm set" icon — everything in the status bar, except the battery indicator). I'm pretty sure it would pass App Store validation, but hopefully a review…
@implementation UIApplication (StatusBarForegroundColor)
- (void)setStatusBarForegroundColor:(UIColor *)foregroundColor {
SEL statusBarSelector = NSSelectorFromString(@"statusBar");
if ([self respondsToSelector:statusBarSelector]) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
id statusBar = [[UIApplication sharedApplication] performSelector:statusBarSelector
withObject:nil];
/*
@scottjacksonx
scottjacksonx / NSFileManager+WhereFromXAttr.h
Last active June 12, 2016 23:45
Quick category on NSFileManager to read in and return the kMDItemWhereFroms extended attribute of a file on disk.
#import <Foundation/Foundation.h>
@interface NSFileManager (WhereFromXAttr)
/// Returns the value of a given file's com.apple.metadata:kMDItemWhereFroms extended attribute.
- (NSArray *)valueForWhereFromExtendedAttributeOfFile:(NSString *)path;
@end
# This is the guts of a Service that lets you select a method in Xcode (either a definition or a call),
# click "Copy Selector", and copy the selector for that method to the pasteboard. For example:
#
# “- (void)bar;” → “bar” on the pasteboard
#
# “- (void)doThing:(type *)thing withOptions:(type*)options” → “doThing:withOptions:” on the pasteboard
#
# “[foo barWithOptions:options]” → “barWithOptions:” on the pasteboard
#
# “[[foo barWithBaz:[baz barWithProperty:thing.backgroundColor]] doThing:thing withOptions:options];” →
@scottjacksonx
scottjacksonx / gist:3285575
Created August 7, 2012 13:59
DECO3500/7350 General Blog Feedback

As we mentioned in the workshops, from time to time we’ll be giving everyone some general feedback about the interaction blog posts. If you don't have time to read all this jibber-jabber and just want to skim, the super-important stuff is in bold.

Overall, everyone got the idea that they’re meant to pick a social/mobile app or service and write about it. However, there were three patterns that we saw in a few of the blog posts that we’d like to talk about.

  1. The first issue we found was that some people chose to write about an app/service that has a social element, but their post wasn’t about the social features of the app. Since this is a course about social and mobile software, you should write about the social and mobile aspects of the app or service you've chosen. If you’re going to write about Steam (which a few people did, and it’s a great choice), write about the aspects of Steam that are relevant to this course — the social, mobile, or CSCW elements. For example,
@scottjacksonx
scottjacksonx / NSString+AppName.h
Created July 10, 2012 06:00
From an app bundle identifier, return the name of that app
//
// NSString+AppName.h
//
// Created by Scott Jackson on 4/07/12.
// Copyright (c) 2012 SJSoftware. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSString (AppName)
@scottjacksonx
scottjacksonx / NSWorkspace+ApplicationForOpeningURL.h
Created July 10, 2012 05:58
Checking whether your Mac has an app to open a URL
//
// NSWorkspace+ApplicationForOpeningURL.h
//
// Created by Scott Jackson on 10/07/12.
// Copyright (c) 2012 SJSoftware. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface NSWorkspace (ApplicationForOpeningURL)
@scottjacksonx
scottjacksonx / Corinda.css
Created December 6, 2011 11:51
My desktop version of Brent Simmons's “Ballard” style.
/* My desktop version of Brent Simmons's “Ballard” style. */
::selection {
background-color: #f55;
text-shadow: 0px 1px 0px #000;
color: #f9f8f6;
}
body {
color: #333;
@scottjacksonx
scottjacksonx / stylesheet.css
Created November 29, 2011 05:03
My modified of Brent Simmons's “Ballard” NetNewsWire style. I like smaller text when I'm on my 13" MacBook.
body {
color: #333;
font-size: 14px;
line-height: 1.4em;
font-family: Palatino, Georgia, serif;
background-color: #fff;
margin: 0px;
}
a {
text-decoration: none;
@scottjacksonx
scottjacksonx / TypoTextExpander
Created April 20, 2011 16:19
Shawn and Patrick asked about a TextExpander thing, and then I made it.
#!/usr/bin/env python
# coding: utf-8
import random
# Instructions: this is a TextExpander snippet. Copy and paste all of this (starting with #!/usr and
# ending with "— Shawn") as the content of a new snippet in TextExpander. Then, set the content of the
# snippet to "Shell Script".
# This is the list of sentences. Add as many as you want. Just write sentences.append("your sentence here") on