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
#if _WIN32 | |
#include <winsock2.h> | |
#else | |
#include <arpa/inet.h> | |
#include <netinet/in.h> | |
#include <sys/socket.h> | |
#endif | |
#if __APPLE__ || _WIN32 | |
#define MSG_NOSIGNAL 0 |
This file has been truncated, but you can view the full file.
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
master~/src/YOLOKit$ pod trunk push YOLOKit.podspec --verbose | |
Validating podspec | |
> YOLOKit | |
YOLOKit (9) - Analyzing on OS X platform. | |
Analyzing dependencies | |
Fetching external sources | |
-> Fetching podspec for `YOLOKit` from `/Users/mxcl/src/YOLOKit/YOLOKit.podspec` |
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
dispatch_promise(^{ | |
return md5(email); | |
}).then(^(NSString *md5){ | |
return [NSURLConnection GET:@"http://gravatar.com/%@", md5]; | |
}).then(^(UIImage *gravatarImage){ | |
self.imageView.image = gravatarImage; | |
}); |
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
enum FizzBuzz { | |
case fizz | |
case buzz | |
case fizzBuzz | |
case number(Int) | |
init(rawValue: Int) { | |
switch (rawValue % 3, rawValue % 5) { | |
case (0, 0): self = .fizzBuzz | |
case (0, _): self = .fizz |
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
// Trying to write a function that does some select/map magic with easy error handling | |
let cities = [[ | |
"name": "Geneva", | |
"population": 184538 | |
],[ | |
"name": "Bern", | |
"population": 123154 | |
], [ | |
"name": "Zurich", |
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
query.findObjectsInBackgroundWithBlock { (objects: [AnyObject]!, error: NSError!) in | |
if error == nil { | |
self.latitudeArray = objects.map{ $0["latitude"]! as Double } | |
} else { | |
println(error) | |
} | |
} |
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 | |
class BlurryVC: UIViewController { | |
override func loadView() { | |
view = UIVisualEffectView(effect: UIBlurEffect(style: .Light)) | |
} | |
} | |
class ViewController: UIViewController { |
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
- (void)scrollViewDidScroll:(UIScrollView *)scrollView { | |
float y = scrollView.contentOffset.y; | |
////// parallax | |
CGAffineTransform transform; | |
BOOL clip = YES; | |
y -= 320; | |
if (y < -320) { | |
float const required_scale = y / -320; |
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
{ | |
"name": "XMPPFramework", | |
"version": "3.6.4", | |
"platforms": { | |
"ios": "5.0", | |
"osx": "10.7" | |
}, | |
"license": { | |
"type": "BSD", | |
"file": "copying.txt" |
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 Darwin //.C.stdlib | |
// updated for Swift 2.0 beta4 | |
private func merge<T: Comparable>(a: ArraySlice<T>, _ b: ArraySlice<T>, mergeInto acc: ArraySlice<T> = []) -> ArraySlice<T> { | |
guard let aF = a.first, bF = b.first else { | |
return acc + a + b | |
} | |
return aF < bF | |
? merge(dropFirst(a), b, mergeInto: acc + [aF]) |