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
TAGS="TODO:|FIXME:" | |
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -not -path "*/Carthage/*" -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/" |
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/bash | |
if [ ! -z $QUERY_STRING ] | |
then | |
error=""; | |
case $QUERY_STRING in | |
kaffee|"kaffee=") | |
cat <<-"EOK" | |
Status: 418 I'm a teapot | |
Content-type: text/html |
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 { | |
func mapD<T: Hashable, U>(_ elementClosure: ((key: T, value: U) -> (T, U))) -> Dictionary<T, U> { | |
return self.map { (tuple) in | |
return elementClosure(key: tuple.0 as! T, value: tuple.1 as! U) // The compiler demands these casts exist 😕 | |
}.toDictionary() | |
} | |
} | |
extension Sequence { | |
func toDictionary<T: Hashable, U>() -> Dictionary<T, U> { |
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 { | |
func mapValues<TransformedValue: Sequence where Value: Sequence>(transform: (Value) -> TransformedValue) -> Dictionary<Key, TransformedValue> { | |
var newDict: [Key: TransformedValue] = [:] | |
for (k, v) in self { | |
newDict[k] = transform(v) | |
} | |
return newDict | |
} | |
} |
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 { | |
func mapValues<T>(transform: (Value) -> T) -> Dictionary<Key, T> { | |
return Dictionary<Key, T>(zip(self.keys, self.values.map(transform))) | |
} | |
init<S: Sequence where S.Iterator.Element == (Int, [String])>(_ seq: S) { | |
self.init() | |
for (key, val) in seq { | |
self[key] = val // (!) Ambiguous reference to member 'subscript' | |
} |
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 coords = [ | |
13.723288596942021, | |
51.02547875103679, | |
13.723312997594022, | |
51.02553463039252, | |
13.723399424330877, | |
51.02551749405676 | |
] | |
let lats = coords.enumerated().filter({ $0.offset % 2 == 0 }).map { $1 } |
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/bin/env xcrun swift | |
import Foundation | |
struct Pod { | |
let source: String | |
let name: String | |
let version: String | |
let platforms: 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
#import <Foundation/Foundation.h> | |
@interface Person : NSObject | |
{ | |
@private char *name; | |
} | |
@property (readwrite, assign) char *name; | |
- (void)sayHello; | |
@end |
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
package main | |
import ( | |
"bytes" | |
"encoding/json" | |
"fmt" | |
"html" | |
"io/ioutil" | |
"net/http" | |
"os" |
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
POST http://webapi.vvo-online.de/dm?format=json | |
Accept: application/json, text/plain, */* | |
{ | |
"stopid": "33000037", | |
"time": "2016-11-13T16:01:12Z", | |
"isarrival": false, | |
"limit": 30, | |
"shorttermchanges": true, |