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
/* Extends the Class Object Written by Resig. http://ejohn.org/blog/simple-javascript-inheritance/ */ | |
Class.prototype.addObserver = function(/** String */ key, /** Object */ observer, /** Function */ method) | |
{ | |
if (key !== null && key !== undefined && | |
observer !== null && observer !== undefined && | |
method !== null && method !== undefined) | |
{ | |
eval("this._" + key + " = this." + key); | |
this.__defineGetter__(key, function() |
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
extension NSError{ | |
//... | |
class func | |
myParseError(description:String?="Parse failed.") -> NSError { | |
let info = [NSLocalizedDescriptionKey: description] | |
return self( | |
domain:myDomain, | |
code:MyErrorCodes.ParseError.rawValue, | |
userInfo:info) |
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
/** | |
Group all items in a collection according to the value returned by a block. | |
:param: collection The collection whose items you want to group. | |
:param: groupBlock A block that returns a key for that value to be grouped by. | |
:returns: Returns a dictionary whose keys are the values returned by the groupBlock. | |
*/ | |
func groupBy<V, K : protocol<Hashable, Equatable>, C : _ExtensibleCollectionType where C.Generator.Element == V>(collection: C, groupBlock: (V) -> K) -> [K: [V]] { | |
typealias ValueGroup = [V] |
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
### Keybase proof | |
I hereby claim: | |
* I am tapi on github. | |
* I am tapi (https://keybase.io/tapi) on keybase. | |
* I have a public key whose fingerprint is B8A2 FE8D A75F 3FD8 9114 77D5 E7E6 6A04 5D6C 1382 | |
To claim this, I am signing this object: |
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
_imageView = ({ | |
UIImageView *imageView = [[UIImageView alloc] init]; | |
imageView.contentMode = UIViewContentModeScaleAspectFill; | |
[self.scrollView addSubview:imageView]; | |
imageView; | |
}); |
NewerOlder