Skip to content

Instantly share code, notes, and snippets.

# According to
# Install ImageMagick with MacPort: sudo port install ImageMagick
# Install ImageMagick with Homebrew: brew install ImageMagick
# Assume source icon is 1024x1024
blur3="-gaussian-blur 3x3"
blur4="-gaussian-blur 4x4"
blur7="-gaussian-blur 7x7"
blur8="-gaussian-blur 8x8"
xinsight / gist:4717701
Created Feb 5, 2013
List Comprehension
View gist:4717701
NSArray *a = @[@"Hello", @"Will This work?", @"can it work?", @"Yes!"];
// sure, this works...
NSMutableArray *b = [NSMutableArray arrayWithCapacity:[a count]];
[a enumerateObjectsUsingBlock: ^(id obj, NSUInteger idx, BOOL *stop) {
[b insertObject: [obj uppercaseString] atIndex: idx];
xinsight / gist:4690180
Last active Dec 12, 2015
example of AFNetworking's nice wrapper to the Apple's hairy Reachability code.
View gist:4690180
_reachability = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@""]];
[_reachability setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
switch (status) {
case AFNetworkReachabilityStatusNotReachable:
[self.reachabilityDelegate networkIsReachable:NO];
case AFNetworkReachabilityStatusReachableViaWiFi:
case AFNetworkReachabilityStatusReachableViaWWAN:
[self.reachabilityDelegate networkIsReachable:YES];
xinsight / PlaylistItem.m
Created Mar 2, 2012
Draw method for a playlist item that shows the playhead position. Uses path clipping to round corners on top and bottom. (2009)
View PlaylistItem.m
#define CORNER_RADIUS 10
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(context, 0.0, 0.0, 0.0, 0.5); // black
if ([type isEqualToString:@"top"]) { // curved top
CGContextBeginPath (context);
CGContextMoveToPoint(context, 0, self.frame.size.height); // start: bottom-left
xinsight / DoubleLabel.h
Created Mar 2, 2012
Tap label to toggle between two pieces of text. A nice trick to de-clutter an interface.
View DoubleLabel.h
// DoubleLabel.h
// LongTermTimer
// Created by Jason Moore on 11-05-31.
// Copyright 2011 xinsight. All rights reserved.
#import <UIKit/UIKit.h>
You can’t perform that action at this time.