Skip to content

Instantly share code, notes, and snippets.

@novi
novi / CoreFoundationOwnClassTest.c
Created October 28, 2010 08:39
Create your own CFType Class
// Created by Yusuke Ito, @novi_
#include <CoreFoundation/CoreFoundation.h>
#define UseCFHeader 0
#if UseCFHeader
#include "CFRuntime.h"
#else
@novi
novi / gist:789414
Created January 21, 2011 08:21
CoreGraphicsの低レベルAPIの調査(一覧)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework
のライブラリ
パスはリンクしているライブラリ(主要ライブラリを除く)
libCFilter.A.dylib:
/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
libCGATS.A.dylib:
@novi
novi / _CFHash: armv6 disassemble
Created January 25, 2011 18:01
_CFHash: armv6 disassemble
_CFHash:
000074fc b5b0 push {r4, r5, r7, lr}
000074fe af02 add r7, sp, #8
00007500 1e04 subs r4, r0, #0
00007502 d034 beq.n 0x756e
00007504 6821 ldr r1, [r4, #0]
00007506 2900 cmp r1, #0
00007508 d01d beq.n 0x7546
0000750a 4b20 ldr r3, [pc, #128] (0x758c)
0000750c 447b add r3, pc
@novi
novi / CocoaDesignPattern-Summary.md
Created February 15, 2011 17:54
Cocoaのデザインパターンまとめ
  • Singleton
  • Abstract Factory - |NSWindow| (Theme, Style)
  • Builder - WebKit Document Representation
  • Prototype - |NSCollectionViewItem|, Cell
  • FactoryMethod - |NSDocument|, ClassCluster
  • Adapter - Delegate, CocoaBinding
  • Bridge - |NSImageRep|, Wrapper
  • Composite - View Hierarchy, Tree
  • Decorator - |NSBox|, |NSScrollView|
  • Facade - |NSTextView|
@novi
novi / gist:939582
Created April 24, 2011 14:37
-[UIBezierPath stroke] arm
-[UIBezierPath stroke]:
000f1470 e92d40b0 push {r4, r5, r7, lr}
000f1474 e28d7008 add r7, sp, #8 @ 0x8
000f1478 e1a05000 mov r5, r0
000f147c ebfcb22d bl _UIGraphicsGetCurrentContext
000f1480 e1a04000 mov r4, r0
000f1484 eb0bce73 bl 0x3e4e58 @ symbol stub for: _CGContextSaveGState
000f1488 e59f30c8 ldr r3, [pc, #200] @ 0xf1558
000f148c e1a00004 mov r0, r4
000f1490 e79f1003 ldr r1, [pc, r3]
@novi
novi / gist:939592
Created April 24, 2011 14:45
otool -o option
UIKit (architecture armv6):
Contents of (__DATA,__objc_classlist) section
0048edf4 0x4f5cb0
isa 0x4f5c9c
superclass 0x4f6020
cache 0x0
vtable 0x0
data 0x490274 (struct class_ro_t *)
flags 0x0
instanceStart 44
@novi
novi / sample.pdf
Created April 27, 2011 14:26
日本語のサンプルPDF(手打ち) 一部Requiredオブジェクト無し
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@novi
novi / header.h
Created May 24, 2011 14:17
object-dummy1
typedef void* StringRef;
StringRef StringCreateWithCString(const char* cstr); // Stringを作成
StringRef StringCreateFromFile(const char* path); // ファイルから作成
int StringGetLength(StringRef str); // 文字列の長さを取得
float StringGetFloat(StringRef str); // 文字列から数値に変換
int StringGetInt(StringRef str);
@novi
novi / test.m
Created May 28, 2011 16:34
CGRectIntegralの謎
-(void)testRect
{
CGRect r = CGRectMake(1.222, 1.3333, 1, 1.000);
NSLog(@"%@", NSStringFromCGRect(r));
NSLog(@"%@", NSStringFromCGRect(CGRectIntegral(r)));
NSLog(@"%@", NSStringFromCGRect(CGRectMake(floorf(r.origin.x), floorf(r.origin.y), floorf(r.size.width), floorf(r.size.height))));
NSLog(@"%@", NSStringFromCGRect(CGRectMake(ceilf(r.origin.x), ceilf(r.origin.y), ceilf(r.size.width), ceilf(r.size.height))));
STAssertTrue(CGRectEqualToRect(r, CGRectIntegral(r)), nil, nil);
}
@novi
novi / pdfwalker.on.Mac.txt
Created June 17, 2011 15:56
PDFWalkerインストール on Mac OS X 10.6.7
* brew install libtiff
* brew install gtk+
** gtk+のインストールに失敗するときは、 https://twitter.com/novi_/status/81740297842868225
** /usr/local/lib/libintl.dylibが無いときは、 https://twitter.com/novi_/status/81742895941558272
* gem install origami gtk2
* mkdir -p ~/.local/share
** pdfwalkerが起動しないとkは、 /Library/Ruby/Gems/1.8/gems/origami-1.0.3/bin/pdfwalker:3 RUBY_VERSION を1.8以上にする