Skip to content

Instantly share code, notes, and snippets.

View Lewuathe's full-sized avatar
🈂️
👍

Kai Sasaki Lewuathe

🈂️
👍
View GitHub Profile
@Lewuathe
Lewuathe / ref.js
Created November 12, 2012 00:49
Pattern of the reference to this object in instance method.
function Obj(){
this.prop = 'PROP';
}
Obj.prototype.refToProp = function(){
// Only self can refer to the Obj instance object.
// So if you want to refer in other function, self variable is need to be defined.
var self = this;
setTimeout(function(){
console.log(self.prop);
@Lewuathe
Lewuathe / setup.m
Created December 5, 2012 13:06
The template of OpenGL setup
// Generate Vertex array object
glGenVertexArraysOES(1, &_triangleArray);
// Binding VAO
glBindVertexArrayOES(_triangleArray);
// Generate Vertex buffer object
glGenBuffers(1, &_triangleBuffer);
// Binding VBO
glBindBuffer(GL_ARRAY_BUFFER, _triangleBuffer);
// Send buffer data
@Lewuathe
Lewuathe / matrixes.m
Created December 11, 2012 12:21
OpenGL ESでオブジェクトを動かす ref: http://qiita.com/items/f39568a8da1cccb6e5f0
_projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(65.0f), aspect, 0.1f, 100.0f);
_baseViewMatrix = GLKMatrix4Translate(GLKMatrix4Identity, 0.0f, 0.0f, _nearness);
_modelViewMatrix = GLKMatrix4Multiply(GLKMatrix4Identity, _baseViewMatrix);
@Lewuathe
Lewuathe / file2.txt
Created December 14, 2012 03:16
regex.hとloopのパフォーマンス比較 ref: http://qiita.com/items/b749303f88dd030b339c
$ time ./regexTime
real 0m0.005s
user 0m0.002s
sys 0m0.002s
@Lewuathe
Lewuathe / file0.txt
Created December 15, 2012 13:02
Objectice-Cでのinitではまった ref: http://qiita.com/items/50b3cfae7f475f57d765
- (MyClass*)init:(double)paramA with:(double)paramB;
@interface MyClass() : NSObject{
}
- (void)myMethod;
@end
$ git rm necessary_file.txt
Oops!!
$ git reset HEAD necessary_file.txt
$ git checkout necessary_file.txt
@Lewuathe
Lewuathe / file0.txt
Created December 21, 2012 14:33
Remote repositoryの削除 ref: http://qiita.com/items/a081fcd6e4b19dc550ca
$ git remote origin :branch_name
@Lewuathe
Lewuathe / MyClass.h
Created December 25, 2012 12:44
自作delegateメソッドの作り方 ref: http://qiita.com/items/d848e0756e15613e41c6
@class MyClass;
@protocol MyClassDelegate
@optional
-(void)optionDelegateMethod:(MyClass*)myClass;
@required
-(void)requiredDelegateMethod:(MyClass*)myClass;
CXX=g++
LIBS=-lcppunit
SOURCES=someTest.cc some.cc
TARGETS=mainTest
all :
g++ -o mainTest mainTest.cc $(SOURCES) $(LIBS)
clean :
rm $(TARGET)