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
/* 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 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
// | |
// NSObject+SMDictionaryMapping.h | |
// SoundTrack | |
// | |
// Created by Paddy O'Brien on 12-04-24. | |
// Copyright (c) 2012 Paddy O'Brien. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
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
######################### | |
# .gitignore file for Xcode4 / OS X Source projects | |
# | |
# Version 2.0 | |
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects | |
# | |
# 2013 updates: | |
# - fixed the broken "save personal Schemes" | |
# | |
# NB: if you are storing "built" products, this WILL NOT WORK, |
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
# Xcode sets up its own PATH variable so we want to ensure that it includes /usr/local/bin | |
PATH=$PATH:/usr/local/bin | |
# Check that mogenerator is available | |
command -v mogenerator >/dev/null 2>&1 || { echo >&2 "You need mogenerator but it's not installed. To install using homebrew use 'brew install mogenerator'. Aborting."; exit 1; } | |
# Change the working dir to where our models are | |
cd "${SRCROOT}"/Models | |
# Only run mogenerator if the access time for ResultsCache.xcdatamodeld is newer than our lock file |
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
# Xcode sets up its own PATH variable so we want to ensure that it includes /usr/local/bin | |
PATH=$PATH:/usr/local/bin | |
# Check that mogenerator is available | |
command -v mogenerator >/dev/null 2>&1 || { echo >&2 "You need mogenerator but it's not installed. To install using homebrew use 'brew install mogenerator'. Aborting."; exit 1; } | |
# Change the working dir to where our models are | |
cd "${SRCROOT}"/Models | |
# Only run mogenerator if the access time for ResultsCache.xcdatamodeld is newer than our lock file |
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
- (void)didMoveToParentViewController:(UIViewController *)parent | |
{ | |
[super didMoveToParentViewController:parent]; | |
if ([parent isKindOfClass:[UIPageViewController class]]) { | |
UIScrollView *scrollView; | |
for (UIView *view in parent.view.subviews) { | |
if ([view isKindOfClass:[UIScrollView class]]) { | |
scrollView = (UIScrollView *)view; | |
} |
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
_imageView = ({ | |
UIImageView *imageView = [[UIImageView alloc] init]; | |
imageView.contentMode = UIViewContentModeScaleAspectFill; | |
[self.scrollView addSubview:imageView]; | |
imageView; | |
}); |
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
### 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 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
func anyCommonElements <T, U where T: Sequence, U: Sequence, T.GeneratorType.Element: Equatable, T.GeneratorType.Element == U.GeneratorType.Element> (lhs: T, rhs: U) -> Bool { | |
for lhsItem in lhs { | |
for rhsItem in rhs { | |
if lhsItem == rhsItem { | |
return true | |
} | |
} | |
} | |
return false | |
} |
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
/** | |
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] |
OlderNewer