Skip to content

Instantly share code, notes, and snippets.

Abizer Nasir Abizern

Block or report user

Report or block Abizern

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 Scanner+Swift.swift
// Scanner+Swift.swift
//
// A set of idiomatic swift extensions to Scanner
//
// Based on https://gist.github.com/natecook1000/59bb0c9117b555f5d40d
// Converted to Swift 3
//
import Foundation
@Abizern
Abizern / NSURL+StandardURLs.swift
Last active Jan 4, 2016
NSURL extension for common directory URLs
View NSURL+StandardURLs.swift
import Foundation
/// abstract: Convenience methods for getting standard URLs
extension NSURL {
/// The URL to the Documents directory
static var documentsURL: NSURL {
return try! NSFileManager.defaultManager().URLForDirectory(.DocumentDirectory, inDomain: .UserDomainMask, appropriateForURL: nil, create: true)
}
@Abizern
Abizern / Cartfile.private
Last active Feb 5, 2016
Common Cartfile
View Cartfile.private
github "jspahrsummers/xcconfigs"
github "JungleCandy/LoggingPrint"
@Abizern
Abizern / Timer.swift
Last active Apr 20, 2016
An example of overloaded functions in Swift. - More explanation at http://abizern.org/2015/10/11/swift-function-overloading-by-return-type/
View Timer.swift
//: Playground - noun: a place where people can play
import Foundation
import XCPlayground
XCPlaygroundPage.currentPage.needsIndefiniteExecution = true
// Extend NSTimeInterval to provide the conversion functions.
extension NSTimeInterval {
@Abizern
Abizern / RepeatingTimer.swift
Last active Dec 8, 2016
A function that creates and starts a timer dispatch source.
View RepeatingTimer.swift
//
// RepeatingTimer.swift
//
import Foundation
enum TimerError: ErrorType {
/// The timer could not be created.
case CouldNotCreate
}
@Abizern
Abizern / formatter.swift
Last active Aug 29, 2015
You don't need to declare a custom class to have a singleton formatter, just use a global lazy var.
View formatter.swift
var formatter: NSNumberFormatter = {
let f = NSNumberFormatter()
f.locale = NSLocale.currentLocale()
f.maximumFractionDigits = 2
f.minimumFractionDigits = 2
f.alwaysShowsDecimalSeparator = true
f.numberStyle = .CurrencyStyle
return f
}()
@Abizern
Abizern / loggingPrint.swift
Last active Jan 3, 2019
Debug logging for Swift
View loggingPrint.swift
//
// LoggingPrint.swift
//
import Foundation
/**
Prints the filename, function name, line number and textual representation of `object` and a newline character into
the standard output if the build setting for "Active Complilation Conditions" (SWIFT_ACTIVE_COMPILATION_CONDITIONS) defines `DEBUG`.
@Abizern
Abizern / MockingTest.m
Last active Jan 4, 2016
Test for OCMock installation into an Xcode project.
View MockingTest.m
//
// MockingTest.m
//
#import <OCMock/OCMock.h>
@interface MockingTest : XCTestCase
@end
@Abizern
Abizern / SmokeSpec.m
Created May 1, 2014
A simple test file that can be added to a project to smoke test the Specta and Expecta installation
View SmokeSpec.m
//
// SmokeSpec.m
//
#define EXP_SHORTHAND
#import <Specta/Specta.h>
#import <Expecta/Expecta.h>
SpecBegin(SmokeTest)
View cookie.hs
You can’t perform that action at this time.