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
/** | |
* Foo restful interface. | |
*/ | |
trait FooRoute extends HttpService with AskSupport { | |
import examples.FooProtocol._ | |
import examples.FooProtocolV2._ | |
implicit val timeout: Timeout | |
implicit val fooActorPath: ActorPath |
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 | |
// Routes | |
// | |
// Created by Chris Eidhof on 17/08/14. | |
// Copyright (c) 2014 Chris Eidhof. All rights reserved. | |
// | |
import Foundation |
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
// This code accompanies a blog post: http://chris.eidhof.nl/posts/json-parsing-in-swift.html | |
// | |
// As of Beta5, the >>= operator is already defined, so I changed it to >>>= | |
import Foundation | |
let parsedJSON : [String:AnyObject] = [ | |
"stat": "ok", | |
"blogs": [ |
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
// Playground - noun: a place where people can play | |
// | |
// | |
// By: Hooman Mehr ([email protected]) | |
// Gist: https://gist.github.com/hooman/599e381d5f037b87d20b (The latest version is always here) | |
// | |
// | |
// Update: 07/30/2014 | |
// Added WeaklyOwned & removeOrphans for memory management support, added more generics & basic access control. | |
// 08/06/2014 |
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> | |
#define GENERIC(type, parameterType) __typeof__(type (^)(parameterType)) | |
#define GENERIC_DERIVED_TYPE(genericObject) __typeof__(genericObject(NULL)) | |
@interface MAList : NSObject | |
- (id)initWithArray: (NSArray *)array; |
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
#!/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -i -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk | |
import Foundation | |
class JSON { | |
struct Path: Printable { | |
enum Element { | |
case Index(Int) | |
case Key(String) |
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
Promised speed: | |
0.1s https://dl.dropboxusercontent.com/s/bpgountdjrbs17n/2014-06-09%20at%2019.00.png | |
Actual speed: | |
575s https://dl.dropboxusercontent.com/s/2kbn5p1g4t03fvl/2014-06-09%20at%2019.00%20%281%29.png | |
With optimizations: |
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
// | |
// ColorExtension.swift | |
// | |
// Created by Bastian Hoyer on 07.06.14. | |
// Copyright (c) 2014 Bastian Hoyer. All rights reserved. | |
// | |
import UIKit | |
func int2rgb(rgbValue: CUnsignedInt) -> (CGFloat, CGFloat, CGFloat) { |
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
// | |
// Async.swift | |
// TestSwiftUI | |
// | |
// Created by Plumhead on 06/06/2014. | |
// | |
// There are many holes in this which will be ironed out over time - put up as a starting point for ideas | |
// | |
import Foundation |
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
// Let's define a basic Swift class. | |
class Fruit { | |
var type=1 | |
var name="Apple" | |
var delicious=true | |
} | |
// We can get at some info about an instance of an object using reflect(), which returns a Mirror. | |
reflect(Fruit()).count | |
reflect(Fruit())[1].0 |