What happens if you tell GitHub it's JSON
{
"hello": "world" // I want my comments!
}
Use jsonc
as the language instead
{
{ | |
"People" : [ | |
{ | |
"Symbol" : "😀", | |
"Name" : "GRINNING FACE" | |
}, | |
{ | |
"Symbol" : "😬", | |
"Name" : "GRIMACING FACE" | |
}, |
What happens if you tell GitHub it's JSON
{
"hello": "world" // I want my comments!
}
Use jsonc
as the language instead
{
// Swift Standard Librray - String | |
// Keith Harrison http://useyourloaf.com | |
// Import Foundation if you want to bridge to NSString | |
import Foundation | |
// ==== | |
// Initializing a String | |
// ==== |
COMPACT WIDTH (stacked view) | |
- 320 x 568 pt | |
-> iPhone 5, 5s | |
- 320 x 768 pt | |
-> iPad 9.7" Split Landscape 2/3 right | |
- 320 x 834 pt | |
-> iPad 10.5" Split Landscape 2/3 right | |
- 320 x 1024 pt | |
-> iPad 9.7" Split Portrait right |
extension NSDate: Comparable {} | |
public func < (lhs: NSDate, rhs: NSDate) -> Bool { | |
return lhs.compare(rhs) == .OrderedAscending | |
} | |
// Gets you NSDate + NSTimeInterval, NSDate - NSTimeInterval, and NSDate - NSDate. | |
extension NSDate: Strideable { | |
public func advancedBy(n: NSTimeInterval) -> Self { | |
return dateByAddingTimeInterval(n) |
//: Playground - noun: a place where people can play | |
import UIKit | |
enum JSONError : ErrorType { | |
case NoValueForKey(String) | |
case TypeMismatch | |
} | |
public class JSONObject { |
/* | |
1. Adhere to the NSURLSessionDelegate delegate | |
2. Initialize NSURLSession and specify self as delegate (e.g. [NSURLSession sessionWithConfiguration:defaultConfigObject delegate:self delegateQueue: [NSOperationQueue mainQueue]];) | |
3. Add the method below to your class | |
4. Change the certificate resource name | |
*/ | |
- (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential *))completionHandler | |
{ | |
SecTrustRef serverTrust = challenge.protectionSpace.serverTrust; |
// direct check for external keyboard | |
+ (BOOL)_isExternalKeyboardAttached | |
{ | |
BOOL externalKeyboardAttached = NO; | |
@try { | |
NSString *keyboardClassName = [@[@"UI", @"Key", @"boa", @"rd", @"Im", @"pl"] componentsJoinedByString:@""]; | |
Class c = NSClassFromString(keyboardClassName); | |
SEL sharedInstanceSEL = NSSelectorFromString(@"sharedInstance"); | |
if (c == Nil || ![c respondsToSelector:sharedInstanceSEL]) { |
// | |
// Warnings.xcconfig | |
// | |
// The list of warnings we (don’t) use, and the reasons why. | |
// | |
// :MARK: Warnings in use: | |
// :MARK: -everything | |
// We want the best possible diagnostics, so we simply enable everything that exists, and then opt–out of what doesn’t make sense for us. | |
// | |
// :MARK: - Warnings not to be promoted: |
// | |
// AppDelegate.swift | |
// Keychain | |
// | |
// Created by Markos Charatzas on 07/09/2014. | |
// Copyright (c) 2014 qnoid.com. All rights reserved. | |
// | |
import Cocoa |