This file contains hidden or 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
// Here we'll use Swift's IDE-supporting reflect() | |
// function to build a basic JSON serializer. | |
// Per the fine engineers at WWDC, Swift's reflection support | |
// exists purely to support the IDE and the Playground. But | |
// we can have some fun with it anyway. ;) | |
class SerializerBase { | |
} |
This file contains hidden or 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 | |
// church | |
// | |
// Created by Dan Kogai on 6/15/14. | |
// Copyright (c) 2014 Dan Kogai. All rights reserved. | |
// | |
/* Operators */ |
This file contains hidden or 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
func partial<A, B, T>(f: (A, B) -> T, a: A) -> (B) -> T { | |
return { f(a, $0) } | |
} | |
func bind2nd<A, B, T>(f: (A, B) -> T, b: B) -> (A) -> T { | |
return { f($0, b) } | |
} | |
func partial<A, B, C, T>(f: (A, B, C) -> T, a: A) -> (B, C) -> T { |
This file contains hidden or 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
// | |
// Swift-KVO | |
// | |
// Created by Jim Correia on 6/5/14. | |
// Copyright (c) 2014-2015 Jim Correia. All rights reserved. | |
// | |
// Update: 6/17/2014 | |
// | |
// KVOContext has gone away; use the same idiom you'd use from Objective-C for the context | |
// |
This file contains hidden or 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 | |
class AnotherClass { | |
var someVar = 1 | |
let someConst = 2 | |
func somePrivateFunc() -> Bool { | |
return true | |
} |
This file contains hidden or 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/Foundation.h> | |
@interface TestClass : NSObject | |
@end | |
@interface TestClass () | |
@property NSString *name; |
This file contains hidden or 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
diff --git a/protobuf-2.5.0/src/google/protobuf/stubs/once.cc b/protobuf-2.5.0/src/google/protobuf/stubs/once.cc | |
index 1e24b85..e9056ac 100644 | |
--- a/protobuf-2.5.0/src/google/protobuf/stubs/once.cc | |
+++ b/protobuf-2.5.0/src/google/protobuf/stubs/once.cc | |
@@ -63,7 +63,7 @@ void SchedYield() { | |
} // namespace | |
void GoogleOnceInitImpl(ProtobufOnceType* once, Closure* closure) { | |
- internal::AtomicWord state = internal::Acquire_Load(once); | |
+ internal::AtomicWord state = internal::Acquire_Load((volatile internal::Atomic32 *)once); |
This file contains hidden or 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
- (void)rotateView:(UIView *)view | |
byRadianDegrees:(CGFloat)radianDegrees | |
withAnchorPoint:(CGPoint)relativeAnchorPoint | |
{ | |
const CGRect viewBounds = view.bounds; | |
const CGPoint anchorPoint = CGPointMake(viewBounds.size.width * relativeAnchorPoint.x, viewBounds.size.height * relativeAnchorPoint.y); | |
CGAffineTransform transform = CGAffineTransformIdentity; | |
transform = CGAffineTransformTranslate(transform, anchorPoint.x, anchorPoint.y); | |
transform = CGAffineTransformRotate(transform, radianDegrees); |
This file contains hidden or 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
NSURLConnection | NSURLSession | |
------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------- | |
NSURLConnectionDelegate connectionShouldUseCredentialStorage: | | |
------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------- | |
NSURLConnectionDelegate connection:willSendRequestForAuthenticationChallenge: | NSURLSessionDelegate URLSession:didReceiveChallenge:completionHandler: | |
| N |
This file contains hidden or 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
#/usr/local/bin/python | |
import os,sys | |
from xml.etree import ElementTree | |
from PIL import Image | |
def tree_to_dict(tree): | |
d = {} | |
for index, item in enumerate(tree): | |
if item.tag == 'key': | |
if tree[index+1].tag == 'string': |