View gist:5953114
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
// где-то в коде проекта | |
panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(mapDidChange:)]; | |
[panRecognizer setMinimumNumberOfTouches:1]; | |
[panRecognizer setMaximumNumberOfTouches:1]; | |
GoogleMapsView.gestureRecognizers = @[panRecognizer]; // GoogleMapsView это гуглокарта, класс GMSMapView | |
//.. метод, реагирующий на отпускание касания | |
-(void)mapDidChange:(UIPanGestureRecognizer *)pan { | |
if ( panRecognizer.state == UIGestureRecognizerStateBegan ) { | |
// ничего не делать, но можно и что-нибудь делать |
View gist:5952986
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
NSString *uuid = @""; | |
if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) { | |
// This is will run if it is iOS6 or later | |
uuid = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; | |
} else { | |
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | |
id uuidId = [defaults objectForKey:@"deviceUuid"]; | |
if (uuidId) | |
uuid = (NSString *)uuidId; |
View gist:4541756
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
function(doc) { | |
emit(doc.url, doc); | |
} |
View gist:4345440
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
<?php | |
set_time_limit( 0 ); | |
// all dbs | |
$ch = prepareCurlResource(); | |
curl_setopt( $ch, CURLOPT_URL, 'http://localhost:5984/_all_dbs' ); | |
$data = curl_exec( $ch ); | |
$dbs = json_decode( $data ); |
View gist:4328922
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)loadImageFromURL:(NSString *)anUrl { | |
anUrl = [anUrl stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; | |
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:anUrl] | |
cachePolicy:NSURLRequestReturnCacheDataElseLoad | |
timeoutInterval:30.0]; | |
connection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; | |
} |
View gist:2225182
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
var scroller = new StickyScroller("#menu", | |
{ | |
start: 270, | |
end: 50800, | |
interval: 200, | |
range: 100, | |
margin: 0 | |
}); |
View gist:2127026
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
CGRect screenBounds = [[UIScreen mainScreen] bounds]; | |
NSLog(@"%f x %f", screenBounds.size.width, screenBounds.size.height); | |
CGFloat screenScale = [[UIScreen mainScreen] scale]; | |
NSLog(@"%f", screenScale); | |
CGSize screenSize = CGSizeMake(screenBounds.size.width * screenScale, screenBounds.size.height * screenScale); | |
NSLog(@"%f x %f", screenSize.width, screenSize.height); |
View gist:1605260
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 <Availability.h> | |
#ifndef __IPHONE_3_0 | |
#warning "This project uses features only available in iPhone SDK 3.0 and later." | |
#endif | |
#ifdef __OBJC__ | |
#import <UIKit/UIKit.h> | |
#import <Foundation/Foundation.h> | |
#import "YourEverywhereNeededClass.h" |
View gist:1310439
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 "AppDelegate.h" | |
#import "FirstViewController.h" | |
#import "SecondViewController.h" | |
@implementation AppDelegate | |
@synthesize window = _window; | |
@synthesize tabBarController = _tabBarController; |
View gist:1230490
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 <UIKit/UIKit.h> | |
// импортируем фреймворк | |
#import <MapKit/MapKit.h> | |
// добавляем <MKMapViewDelegate> - протокол класса MKMapView | |
@interface mapKitViewController : UIViewController <MKMapViewDelegate> { | |
// создаём MKMapView в контроллере | |
MKMapView *mapView; | |
} |
NewerOlder