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
@objc public protocol ResponseObjectSerializable { | |
init(response: NSHTTPURLResponse, representation: AnyObject) | |
} | |
extension Alamofire.Request { | |
public func responseObject<T:ResponseObjectSerializable>(completionHandler: (NSURLRequest, NSHTTPURLResponse?, T?, NSError?) -> Void) -> Self { | |
let serializer: Serializer = { | |
(request, response, data) in | |
let JSONSerializer = Request.JSONResponseSerializer(options: .AllowFragments) |
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
extension Alamofire.Request { | |
class func imageResponseSerializer() -> Serializer { | |
return { request, response, data in | |
if data == nil { | |
return (nil, nil) | |
} | |
let image = UIImage(data: data!, scale: UIScreen.mainScreen().scale) | |
return (image, nil) |
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 myArray = [1, 2, 3, 4, 5] | |
let longMap = myArray.map({ (number) in | |
return number * 10 | |
}) | |
let convienceMap = myArray.map { number in | |
return number * 10 | |
} | |
let shortMap = myArray.map { $0 * 10 } |
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
if [ -d `brew --prefix`/etc/bash_completion.d ]; then | |
COMPLETIONS=`brew --prefix`/etc/bash_completion.d/* | |
for COMPLETION in $COMPLETIONS | |
do | |
source $COMPLETION | |
done | |
fi |
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
class TheOneAndOnlyKraken { | |
static let sharedInstance = TheOneAndOnlyKraken() | |
} |
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
extension Dictionary { | |
mutating func unionInPlace(dictionary: Dictionary<Key, Value>) { | |
for (key, value) in dictionary { | |
self[key] = value | |
} | |
} | |
mutating func unionInPlace<S: SequenceType where S.Generator.Element == (Key, Value)>(sequence: S) { | |
for (key, value) in sequence { | |
self[key] = value | |
} |
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
require File.expand_path("../../Abstract/abstract-php-extension", __FILE__) | |
class Php54Uopz < AbstractPhp54Extension | |
init | |
homepage 'http://php.net/manual/en/book.uopz.php' | |
url 'https://github.com/krakjoe/uopz/archive/v2.0.7.tar.gz' | |
sha1 '9b49b52954046d7d4b3d41a8ca8f44f724795f8a' | |
head 'https://github.com/krakjoe/uopz.git' | |
version '2.0.7' |
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
#!/bin/sh | |
GIT=`which git` | |
GIT_DIRS=`find vendor -name .git -type d` | |
for GIT_DIR in $GIT_DIRS; do | |
if [ -d "${GIT_DIR}" ]; then | |
WORK_TREE=`dirname ${GIT_DIR}` | |
${GIT} --git-dir=${GIT_DIR} --work-tree=${WORK_TREE} clean -f | |
fi | |
done |
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
<?php | |
$list = []; | |
$keys = ['a', 'x']; | |
foreach ($keys as $key) { | |
$list[] = ['key' => $key, 'quality' => 1]; | |
} | |
array_walk($list, function (&$v, $k) { | |
// Decorate |
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
<?php | |
class Language | |
{ | |
public function getDefaultLanguage() | |
{ | |
return "en-US"; | |
} | |
} | |
class TestClass | |
{ |