Skip to content

Instantly share code, notes, and snippets.

Avatar

Satoshi Asano ninjinkun

View GitHub Profile
View gist:4e61c61cd9f5c90970a4
#import "ScrollsToTopManager.h"
@interface ScrollsToTopManager()
@property (nonatomic) NSHashTable *scrollViews;
@end
@implementation ScrollsToTopManager
+ (instancetype)sharedManager
{
@ninjinkun
ninjinkun / NSURLConnectionRetainTest.m
Last active Dec 16, 2015
does NSURLConnection block method has circular reference problem? Result is no.
View NSURLConnectionRetainTest.m
#import <Foundation/Foundation.h>
@interface BlockTest : NSObject
-(void)request;
@end
@implementation BlockTest {
NSOperationQueue *_queue;
NSString *_str;
}
@ninjinkun
ninjinkun / gist:5361327
Created Apr 11, 2013
ObjC ugomemo sample
View gist:5361327
#import <Foundation/Foundation.h>
id apiRequest(NSString *url)
{
NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
NSHTTPURLResponse *res;
NSError *error;
NSData *data = [NSURLConnection sendSynchronousRequest:req returningResponse:&res error:&error];
if (error) {
return nil;
View gist:3888103
// NSString* url = [NSString stringWithFormat:@"http://api.twitter.com/1/users/profile_image?size=normal&screen_name=%@", [screenName gtm_stringByEscapingForURLArgument]];
NSString *url = [NSString stringWithFormat:@"http://n.hatena.ne.jp/%@/profile/image?type=face", screenName]; // はてなのURLに変更
@ninjinkun
ninjinkun / itc.pl
Created Feb 14, 2012
Itunes Connect Report Downloader
View itc.pl
#!perl
use common::sense;
use HTTP::Request::Common;
use LWP::UserAgent;
use URI;
use Compress::Zlib;
use Perl6::Say;
my $uri = URI->new("https://reportingitc.apple.com/autoingestion.tft");