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
# categories.py | |
class category(object): | |
def __init__(self, mainModule, override = True): | |
self.mainModule = mainModule | |
self.override = override | |
def __call__(self, function): | |
if self.override or function.__name__ not in dir(self.mainModule): | |
setattr(self.mainModule, function.__name__, 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
But our greatest triumph comes not from flexing the metacarpal bone and making a fist, | |
which always seems to be thirsting to be clenched… | |
No, no, no, no, no. | |
Our greatest moment is when we open our hand: | |
cradling a glass of wine, cupping a loved one’s chin. | |
And the best… the most expert of all… keeping all the objects of our life in the air at the same time. | |
My friends, for your amusement and bemusement, I give you the human person. |
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
/*! | |
* Bootstrap Responsive v2.3.0 | |
* | |
* Copyright 2012 Twitter, Inc | |
* Licensed under the Apache License v2.0 | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Designed and built with all the love in the world @twitter by @mdo and @fat. | |
*/.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;line-height:0;content:""}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}@-ms-viewport{width:device-width}.hidden{display:none;visibility:hidden}.visible-phone{display:none!important}.visible-tablet{display:none!important}.hidden-desktop{display:none!important}.visible-desktop{display:inherit!important}@media(min-width:768px) and (max-width:979px){.hidden-desktop{display:inherit!important}.visible-desktop{display:none!important}.visible-tablet{display:inherit!important}.hidden-tablet{display:none!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
operator infix ~> { associativity right } | |
@infix func ~>(firstBlock: (() -> Void), secondBlock: (() -> Void)) -> (() -> Void) { | |
return { | |
dispatch_async(dispatch_get_global_queue(-32768, 0), { | |
firstBlock() | |
dispatch_async(dispatch_get_main_queue(), secondBlock) | |
}) | |
} | |
} |
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
operator infix ⏰ {} | |
@infix func ⏰(time: NSTimeInterval, block: (() -> Void)) { | |
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(time * Double(NSEC_PER_SEC))), dispatch_get_current_queue(), block) | |
} | |
5.0 ⏰ { | |
println("HI!") | |
} |
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
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation | |
{ | |
// Zoom to user location | |
MKMapCamera *camera = [mapView.camera copy]; | |
camera.altitude = 1; // Zoom in | |
camera.centerCoordinate = userLocation.coordinate; | |
mapView.camera = camera; | |
} |
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
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation | |
{ | |
if ([annotation isKindOfClass: [MKUserLocation class]]) | |
return nil; | |
MKPinAnnotationView *pinAnnotationView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier: @"pinAnnotation"]; | |
[pinAnnotationView setAnnotation: annotation]; | |
if (!pinAnnotationView) | |
{ | |
pinAnnotationView = [[MKPinAnnotationView alloc] initWithAnnotation: annotation |
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
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
[SIOSocket socketWithHost: @"http://yourHost:3000" response: ^(SIOSocket *socket) | |
{ | |
self.socket = socket; | |
}]; | |
} |
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
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
[SIOSocket socketWithHost: @"http://yourHost:3000" response: ^(SIOSocket *socket) | |
{ | |
self.socket = socket; | |
__weak typeof(self) weakSelf = self; | |
self.socket.onConnect = ^() |
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
[self.socket on: @"update" callback: ^(SIOParameterArray *args) | |
{ | |
// pinData == @"pinID:lat,long" | |
// self.pins == @{@"pinID": <WPAnnotation @ (lat, long)>} | |
NSString *pinData = [args firstObject]; | |
NSArray *dataPieces = [pinData componentsSeparatedByString: @":"]; | |
NSString *pinID = [dataPieces firstObject]; | |