Skip to content

Instantly share code, notes, and snippets.

Jason Moore xinsight

Block or report user

Report or block xinsight

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View asicon.sh
#!/bin/bash
# According to https://developer.apple.com/library/ios/#qa/qa1686/_index.html
# Install ImageMagick with MacPort: sudo port install ImageMagick
# Install ImageMagick with Homebrew: brew install ImageMagick
# Assume source icon is 1024x1024
blur0=""
blur3="-gaussian-blur 3x3"
blur4="-gaussian-blur 4x4"
blur7="-gaussian-blur 7x7"
blur8="-gaussian-blur 8x8"
@xinsight
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
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:@"http://api.rdio.com/"]];
[_reachability setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
switch (status) {
case AFNetworkReachabilityStatusNotReachable:
[self.reachabilityDelegate networkIsReachable:NO];
break;
case AFNetworkReachabilityStatusReachableViaWiFi:
case AFNetworkReachabilityStatusReachableViaWWAN:
[self.reachabilityDelegate networkIsReachable:YES];
break;
@xinsight
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
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.