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
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web.Http; | |
using MongoDB.Bson; | |
using MongoDB.Driver; | |
using MongoDB.Driver.Builders; | |
namespace Web.Core | |
{ | |
public abstract class MongoApiController<T> : ApiController |
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
@property (nonatomic, assign, getter = isChromeHidden) BOOL chromeHidden; | |
- (BOOL)prefersStatusBarHidden { | |
return self.isChromeHidden; | |
} | |
- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation { | |
return UIStatusBarAnimationSlide; | |
} |
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
@interface UIColor (WBDebugExtensions) | |
@end | |
@implementation UIColor (DebugExtensions) | |
- (id)debugQuickLookObject { | |
UIGraphicsBeginImageContext(CGSizeMake(128, 128)); | |
[self setFill]; | |
[[UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 128, 128)] fill]; |
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
protocol Functor { | |
typealias Element | |
func map<U, UF: Functor where UF.Element == U>(f: Element -> U) -> UF | |
} | |
struct FunctorImpl<T>: Functor { | |
typealias Element = T | |
var value: T |
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
// from https://twitter.com/ashfurrow/status/482488815266045952 | |
func foo (closure: (Array<Int> -> ()) -> ()) { | |
closure({ (array: Array<Int>) -> () in | |
for i in array { | |
i | |
} | |
}) | |
} |
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
!!! There's a better solution here now, that doesn't require swizzling: | |
!!! http://www.splinter.com.au/2014/09/10/afnetworking-error-bodies/ | |
!!! But i'll leave the below swizzling solution up for old time's sake | |
// AFURLSessionManager+ErrorResponse.h | |
// This hacks AFURLSessionManager so that it returns the error response in failure callbacks, in the error's userInfo. | |
// Usage: | |
// [mySessionManager POST:@"some_api_endpoint" parameters:params success:^(NSURLSessionDataTask *task, NSDictionary *responseObject) { |
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
@interface UIView (LayoutConvenience) | |
- (NSLayoutConstraint *)constraintAligningAttribute:(NSLayoutAttribute)attr withView:(UIView *)otherView; | |
@end | |
@implementation UIView (LayoutConvenience) | |
- (NSLayoutConstraint *)constraintAligningAttribute:(NSLayoutAttribute)attr withView:(UIView *)otherView { | |
return [NSLayoutConstraint constraintWithItem:self attribute:attr relatedBy:NSLayoutRelationEqual toItem:otherView attribute:attr multiplier:1.0 constant:0.0]; | |
} | |
@end |
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
@interface FullscreenWindow : UIWindow @end | |
@implementation FullscreenWindow | |
- (void)setRootViewController:(UIViewController *)rootVC { | |
// Try to clear the existing interface orientation, fixes rdar://18906964. | |
// Apparantly in iOS 8.1 the interface orientation doesn't correctly clears out, | |
// which then leads to weird rotation issues. | |
@try {[rootVC setValue:@(UIInterfaceOrientationPortrait) forKey:NSStringFromSelector(@selector(interfaceOrientation))];} | |
@catch (NSException *exception) {} | |
[super setRootViewController:rootVC]; |
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
import groovy.transform.Field | |
// This is a drop-in Gradle script that allows you to easily strip out the packages you don't need | |
// from the Google Play Services library. The script will keep track of previous runs to prevent | |
// restripping each time you build. | |
// HOW TO USE THIS | |
// | |
// 1) Download/copy this strip_google_play_services.gradle file into the same location of your app's | |
// build.gradle file. |
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
let é = "precomposed character!" | |
let é = "decomposed characters!" | |
println(é) // prints "precomposed character!" | |
println(é) // prints "decomposed characters!" |
OlderNewer