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 Cocoa | |
/// A wrapper around any type to make Result compile | |
class Box<T> { | |
let unbox: T | |
init(_ value: T) { | |
self.unbox = value | |
} | |
} |
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 Cocoa | |
// Missing isWord | |
func isWord(string: String) -> Bool { | |
if let _ = Int(string) { return false } | |
let range = NSSpellChecker.shared().checkSpelling(of: string, startingAt: 0) | |
return range.location == NSNotFound | |
} | |
/*: |
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 | |
// Swift rewrite challenge | |
// Starting point: https://gist.github.com/jkereako/200342b66b5416fd715a#file-scale-and-crop-image-swift | |
func scaleAndCropImage( | |
image: UIImage, | |
toSize size: CGSize, | |
fitImage: Bool = true | |
) -> UIImage { |
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 Vapor | |
import HTTP | |
import Foundation | |
extension Node { | |
var backDoorToRealValues: Any { | |
return self.wrapped.backDoorToRealValues | |
} | |
} |
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 Foundation | |
// Extend String to support regex searching by conforming | |
// to CustomStringConvertible | |
extension String: CustomStringConvertible { | |
public var description: String {return self} | |
} | |
// Regex support for keys | |
public extension Dictionary where Key: CustomStringConvertible { |
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
// clang -cc1 -analyzer-checker-help | |
// OVERVIEW: Clang Static Analyzer Checkers List | |
// USAGE: -analyzer-checker <CHECKER or PACKAGE,...> | |
// | |
// CHECKERS: | |
// alpha.core.BoolAssignment Warn about assigning non-{0,1} values to Boolean variables | |
// alpha.core.CallAndMessageUnInitRefArg | |
// Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers, and pointer to undefined variables) | |
// alpha.core.CastSize Check when casting a malloc'ed type T, whether the size is a multiple of the size of T | |
// alpha.core.CastToStruct Check for cast from non-struct pointer to struct pointer |
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 <RestKit/RestKit.h> | |
#import "CoreData+MagicalRecord.h" | |
// Use a class extension to expose access to MagicalRecord's private setter methods | |
@interface NSManagedObjectContext () | |
+ (void)MR_setRootSavingContext:(NSManagedObjectContext *)context; | |
+ (void)MR_setDefaultContext:(NSManagedObjectContext *)moc; | |
@end | |
@implementation AppDelegate |
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
// | |
// main.swift | |
// pggrep - updated 12/4/15 | |
// Created by Erica Sadun on 6/17/15. | |
// Copyright © 2015 Erica Sadun. All rights reserved. | |
// | |
import Foundation | |
extension String { |
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 Cocoa | |
// Note: use of enumeration var in generic is instadeath | |
// Note: use of static var in generic is not yet supported | |
public protocol EnumConvertible: Hashable { | |
init?(hashValue hash: Int) | |
static func countMembers() -> Int | |
static func members() -> [Self] | |
} |
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
# | |
# Uncrustify Configuration File | |
# File Created With UncrustifyX 0.2 (140) | |
# | |
# Alignment | |
# --------- | |
## Alignment |
OlderNewer