This file contains 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
- (void)drawGradientInContext:(CGContextRef)context withStartPosition:(CGPoint)startPosition endPosition:(CGPoint)endPosition startColor:(UIColor *)startColor endColor:(UIColor *)endColor | |
{ | |
CGFloat locations[2] = {0.0, 1.0}; | |
const CGFloat *startComponents = CGColorGetComponents(startColor.CGColor); | |
const CGFloat *endComponents = CGColorGetComponents(endColor.CGColor); | |
CGFloat components[8] = {startComponents[0], startComponents[1], startComponents[2], startComponents[3], endComponents[0], endComponents[1], endComponents[2], endComponents[3]}; | |
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); | |
CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, components, locations, 2); | |
CGContextDrawLinearGradient(context, gradient, startPosition, endPosition, 0); |
This file contains 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 python | |
from AppKit import NSMutableDictionary | |
import os | |
# Get the name of the current configuration. | |
configuration = os.environ['CONFIGURATION'] | |
# List of valid configurations where this script should run. | |
configurations_list = ['Beta', 'App Store'] |
This file contains 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
-- Preview the currently active BBEdit document using Marked. | |
tell application "BBEdit" | |
activate | |
-- Ask BBEdit for it's active document. | |
set the_document to active document of text window 1 | |
-- If the file doesn't alreay exist, ask the user to save it. | |
if not the_document's on disk then | |
save the_document |
This file contains 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
(* | |
Send the URL of the Safari tab to Pinboard from LaunchBar | |
Author: Collin Donnell | |
Website: http://collindonnell.com | |
Date: 2013-01-06 | |
Initially based on script for sending Chrome links to Pinboard | |
using Alfred by Tim Bueno: | |
http://www.timbueno.com/2012/06/27/pinboard-plus-alfred |
This file contains 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
(* | |
Create a new post in Octopress from Launchbar | |
Author: Collin Donnell | |
Website: http://collindonnell.com | |
Date: 01/06/2013 | |
*) | |
on handle_string(postTitle) | |
try |
This file contains 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
(* | |
Generate and deploy Octopress site from Launchbar | |
Author: Collin Donnell | |
Website: http://collindonnell.com | |
Date: 01/07/2013 | |
*) | |
-- Set to the location on disk of your site | |
set octopressLocation to ((path to home folder as text) & "Code:blog:") as alias |
This file contains 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
- (void)safelyMessageTarget:(id)target withSelector:(SEL)selector arguments:(NSArray *)arguments { | |
if ([target respondsToSelector:selector]) { | |
NSMethodSignature *methodSignature = [NSMethodSignature methodSignatureForSelector:selector]; | |
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSignature]; | |
[arguments enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { | |
[invocation setArgument:(__bridge void *)(obj) atIndex:idx]; | |
}]; | |
[invocation invokeWithTarget:target]; |
This file contains 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
// | |
// Created by Collin Donnell on 7/22/15. | |
// Copyright (c) 2015 Collin Donnell. All rights reserved. | |
// | |
import CoreData | |
extension NSManagedObjectContext { | |
convenience init(parentContext parent: NSManagedObjectContext, concurrencyType: NSManagedObjectContextConcurrencyType) { |
This file contains 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 UIKit | |
public extension UITableView { | |
public func deselectSelectedRowAnimated(animated: Bool) { | |
if let indexPath = indexPathForSelectedRow() { | |
deselectRowAtIndexPath(indexPath, animated: animated) | |
} | |
} | |
OlderNewer