Skip to content

Instantly share code, notes, and snippets.

View splhack's full-sized avatar

Kazuki Sakamoto splhack

View GitHub Profile
#import <Foundation/Foundation.h>
typedef void (^completeBlock_t)(NSData *data);
typedef void (^errorBlock_t)(NSError *error);
@interface AsyncURLConnection : NSObject
{
NSMutableData *data_;
completeBlock_t completeBlock_;
errorBlock_t errorBlock_;
#import "AsyncURLConnection.h"
@implementation AsyncURLConnection
+ (id)request:(NSString *)requestUrl completeBlock:(completeBlock_t)completeBlock errorBlock:(errorBlock_t)errorBlock
{
return [[[self alloc] initWithRequest:requestUrl
completeBlock:completeBlock errorBlock:errorBlock] autorelease];
}
#import "cocos2d.h"
typedef void (^textureCallbackBlock_t)(CCTexture2D *texture);
@interface TextureCallback : NSObject
{
textureCallbackBlock_t block_;
}
+ (id)callbackWithBlock:(textureCallbackBlock_t)block;
#import "TextureCallback.h"
@implementation TextureCallback
+ (id)callbackWithBlock:(textureCallbackBlock_t)block
{
return [[[self alloc] initWithBlock:block] autorelease];
}
- (id)initWithBlock:(textureCallbackBlock_t)block
#import <Foundation/Foundation.h>
typedef void (^completeBlock_t)(NSData *data);
typedef void (^errorBlock_t)(NSError *error);
@interface AsyncURLConnection : NSURLConnection
{
NSMutableData *data_;
completeBlock_t completeBlock_;
errorBlock_t errorBlock_;
#import "AsyncURLConnection.h"
@implementation AsyncURLConnection
+ (id)request:(NSString *)requestUrl completeBlock:(completeBlock_t)completeBlock errorBlock:(errorBlock_t)errorBlock
{
return [[[self alloc] initWithRequest:requestUrl
completeBlock:completeBlock errorBlock:errorBlock] autorelease];
}
@splhack
splhack / Makefile
Created May 6, 2011 02:17
Makefile for adb
SRCS+= adb.c
SRCS+= adb_client.c
SRCS+= commandline.c
SRCS+= console.c
SRCS+= file_sync_client.c
SRCS+= fdevent.c
SRCS+= get_my_path_linux.c
SRCS+= services.c
SRCS+= sockets.c
SRCS+= transport.c
@splhack
splhack / gist:1082368
Created July 14, 2011 12:36
CCNode.diff
diff --git a/cocos2d/CCNode.h b/cocos2d/CCNode.h
index d6faaf5..64acdc5 100644
--- a/cocos2d/CCNode.h
+++ b/cocos2d/CCNode.h
@@ -105,6 +107,9 @@ enum {
// position of the node
CGPoint position_;
CGPoint positionInPixels_;
+
+ // skew angles
@splhack
splhack / 0001-suppress-warnings.patch
Created July 16, 2011 13:06
Kowalski: suppress warnings
From 5fa3190bc9a0f4cc31bc5ab9e9e845c62610e5f9 Mon Sep 17 00:00:00 2001
From: Kazuki Sakamoto <sakamoto@splhack.org>
Date: Sat, 16 Jul 2011 21:58:32 +0900
Subject: [PATCH] suppress warnings
---
src/engine/hosts/iphone/kwl_decoder_iphone.c | 8 ++--
src/engine/hosts/iphone/kwl_decoder_iphone.h | 2 +-
src/engine/hosts/iphone/kwl_soundengine_iphone.m | 42 +++++++++++-----------
src/engine/kwl_audiofileutil.c | 10 +++---
diff --git a/libs/squirrel/sqstdlib/sqstdrex.cpp b/libs/squirrel/sqstdlib/sqstdrex.cpp
index 61a15ef..2859875 100644
--- a/libs/squirrel/sqstdlib/sqstdrex.cpp
+++ b/libs/squirrel/sqstdlib/sqstdrex.cpp
@@ -498,25 +498,25 @@ static const SQChar *sqstd_rex_matchnode(SQRex* exp,SQRexNode *node,const SQChar
if(str == exp->_eol) return str;
return NULL;
case OP_DOT:{
- *str++;
+ str++;