Skip to content

Instantly share code, notes, and snippets.

Amber Star amberstar

Block or report user

Report or block amberstar

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
robin / gist:62684
Created Feb 12, 2009
round corner uiimage
View gist:62684
#import "ImageManipulator.h"
@implementation ImageManipulator
static void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWidth, float ovalHeight)
float fw, fh;
if (ovalWidth == 0 || ovalHeight == 0) {
CGContextAddRect(context, rect);
odrobnik / gist:1789418
Created Feb 10, 2012
Asynchronous Deletion
View gist:1789418
// DTAsyncFileDeleter.m
// DTFoundation
// Created by Oliver Drobnik on 2/10/12.
// Copyright (c) 2012 Cocoanetics. All rights reserved.
#import "DTAsyncFileDeleter.h"
bsneed / NSObject+RFExtensions.h
Created Oct 6, 2012
perform a block in a background thread, and call a completion block on the main thread when its done.
View NSObject+RFExtensions.h
// NSObject+RFExtensions.h
// Created by brandon on 10/5/12.
// Copyright (c) 2012 All rights reserved.
#import <Foundation/Foundation.h>
typedef void (^NSObjectPerformBlock)(id userObject);
anonymous / modifiedCopy.swift
Created Oct 28, 2015
turn foo.xInPlace(arg) into a foo.x(arg)...
View modifiedCopy.swift
func modifiedCopy<Struct, Arg>(start: Struct, @noescape mutator: (inout Struct) -> Arg -> (), arg: Arg) -> Struct {
var new = start
return new
extension Array {
func arrayByAppending(e: Element) -> Array {
return modifiedCopy(self, mutator: Array.append, arg: e)
subdigital / pns.m
Created Jan 5, 2013
What are your favorite Xcode Snippets? Add them in the comments.
View pns.m
// Property Nonatomic Strong
// Platform: All
// Completion Scopes: ClassInterfaceMethods
@property (nonatomic, strong) <# class_name #> *<# variable_name #>;
View App Store Refund
You can get a refund for any app on the App Store by following this process:
1. Visit
2. Sign In with your Apple ID.
3. Click “Report a Problem” on the offending app.
4. Choose “Problem is not listed here” and be sure to mention that you are asking for a refund because it doesn’t work as expected.
davedelong / UpdateRepositories.swift
Last active Jan 30, 2017
A headless Swift program that keeps a directory of git repositories up-to-date
View UpdateRepositories.swift
import Foundation
func scanForRepositories(directory: NSURL, root: NSURL) {
let fileManager = NSFileManager.defaultManager()
let options: NSDirectoryEnumerationOptions = .SkipsSubdirectoryDescendants | .SkipsPackageDescendants
if let contents = fileManager.contentsOfDirectoryAtURL(directory, includingPropertiesForKeys: [NSURLIsDirectoryKey], options: options, error: nil) {
let urls = contents as Array<NSURL>
mackworth / Obectivej-C to Swift Syntax
Last active Oct 13, 2017
Table showing the major translations from Objective-C to Swift syntax
View Obectivej-C to Swift Syntax

Conversion Process from Objective-C syntax to Swift The most important first step is to run Apple's "Convert to Modern Objective-C Syntax" refactoring, so that you're using array/dictionary literals and bracket-accesses; these will then be usable in Swift. Note also that I'm a beginner in Swift, so my apologies for any mistakes or incompleteness here.

When you see this pattern Replace with this
@interface *newType* : *superType* <*protocol1*, *protocol2*> class *newType* : *superType*, *protocol1*, *protocol2*
@implementation OR @synthesize OR @end Delete
CodaFi / Free.swift
Created Sep 20, 2014
Free Monads in Swift
View Free.swift
// Free.swift
// Swift_Extras
// Created by Robert Widmann on 9/19/14.
// Copyright (c) 2014 Robert Widmann. All rights reserved.
import Foundation
View Format code script for Xcode
~/Applications/UniversalIndentGUI/indenters/uncrustify -l OC -q -c ~/Applications/UniversalIndentGUI/config/uncrustify_obj_c.cfg
You can’t perform that action at this time.