Skip to content

Instantly share code, notes, and snippets.

View .gitattributes
*.pbxproj -crlf -diff -merge
*.xib -crlf -diff -merge
*.nib -crlf -diff -merge
@sazameki
sazameki / gist:178235
Created Aug 31, 2009
Error Handling in init method
View gist:178235
- (id)init {
self = [super init];
if (self) {
if (!foo()) {
[self release];
return nil;
}
}
return self;
}
View OpenGLVersionChecker.m
// Use these codes below after NSOpenGLView is prepared.
#include <OpenGL/gl.h>
- (void)doCheck
{
NSLog(@"gl_version={%s}", glGetString(GL_VERSION));
NSLog(@"gl_renderer={%s}", glGetString(GL_RENDERER));
NSLog(@"gl_vendor={%s}", glGetString(GL_VENDOR));
View JSONParseSample.m
#import "SZJsonParser.h"
NSString *str = @"[ 'Apple', 'Banana' ]";
id obj = [str jsonObject]; // obj will be an array or a dictionary
NSLog(@"JSON Object: %@", obj);
View gist:185812
# ひとつ前のコミットを取り消す
git reset --soft HEAD^
# 直前のコミットに新しい変更点を追加する。
git commit --amend
git push --force
# タグを取り除く
git tag -d TAGNAME
git push origin :refs/tags/TAGNAME
View gist:185814
texturetool -e PVRTC --channel-weighting-linear --bits-per-pixel-2 -o <OUTPUT-FILENAME> -f PVR <INPUT-FILENAME>
texturetool -e PVRTC --channel-weighting-linear --bits-per-pixel-4 -o <OUTPUT-FILENAME> -f PVR <INPUT-FILENAME>
texturetool -e PVRTC --channel-weighting-perceptual --bits-per-pixel-2 -o <OUTPUT-FILENAME> -f PVR <INPUT-FILENAME>
texturetool -e PVRTC --channel-weighting-perceptual --bits-per-pixel-4 -o <OUTPUT-FILENAME> -f PVR <INPUT-FILENAME>
View gist:6016275

タブレットの替え芯あれこれ

総合的なレビュー

@sazameki
sazameki / NSObject + CATransactionSupport
Last active Dec 25, 2015
Make it possible to write Core Animation's animation code with blocks using timers.
View NSObject + CATransactionSupport
@import QuartzCore;
@interface NSObject (CATransactionSupport)
- (NSTimer *)startTimerWithInterval:(NSTimeInterval)interval block:(void (^)(void))block;
- (void)startAnimationWithDuration:(NSTimeInterval)duration block:(void (^)(void))block;
- (void)startAnimationWithDuration:(NSTimeInterval)duration block:(void (^)(void))block completionHandler:(void (^)(void))completionHandler;
@sazameki
sazameki / UIView+ConstraintsUtil.h
Last active Jan 2, 2016
A utility category for utilizing UIKit Auto Layout features efficiently.
View UIView+ConstraintsUtil.h
//
// UIView+ConstraintsUtil.h
//
// Created by numata on 2014/01/02.
// Copyright (c) 2014 Sazameki and Satoshi Numata, Ph.D. All rights reserved.
//
@import UIKit;
@sazameki
sazameki / index.html
Last active Jan 2, 2016
HTML5 Sample
View index.html
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8"/>
<title>ページタイトル</title>
<link rel="stylesheet" href="css/style.css"/>
</head>
<body>
<article>