This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
GridTileItem* tileItem = something; | |
UITapGestureRecognizer *singleFingerOne = [[UITapGestureRecognizer alloc] initWithTarget:self | |
action:@selector(onGridTileItemTouched:)]; | |
singleFingerOne.numberOfTouchesRequired = 1; //手指数 | |
singleFingerOne.numberOfTapsRequired = 1; //tap次数 | |
singleFingerOne.delegate = self; | |
UITapGestureRecognizer *singleFingerTwo = [[UITapGestureRecognizer alloc] initWithTarget:self | |
action:@selector(onGridTileItemTouched:)]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1、打开 Sublime Text 2,按下 Control + ` 调出 Console | |
# 2、将以下代码粘贴进命令行中并回车 | |
import urllib2,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();os.makedirs(ipp) if not os.path.exists(ipp) else None;open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()) | |
# 3、重启 Sublime Text 2,如果在 Preferences -> Package Settings中见到Package Control这一项,就说明安装成功了 | |
# Sublime Text 2 和 Sublime Text 3中Package Control安装方法及下载地址: | |
# https://sublime.wbond.net/installation | |
# Mac系统下长按重复按键 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<SCRIPT LANGUAGE='JavaScript'> | |
function addline(text, textColor) { | |
var newDiv = document.createElement('DIV'); | |
newDiv.style.color = textColor; | |
newDiv.innerHTML = text; | |
document.getElementById('contentDiv').appendChild(newDiv); | |
window.scroll(0,window.document.body.scrollHeight); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int i = 5; | |
int (^test1)() = ^() { | |
return i * i; | |
}; | |
int (^test2)(int); | |
test2 = ^(int a) { | |
return a * a; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Private/var/mobile/Library/Caches/com.apple.mobile.installation.plist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <sys/time.h> | |
//#include <time.h> | |
long getTickCount() | |
{ | |
struct timeval tv; | |
gettimeofday(&tv, NULL); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int numClasses = 0; | |
Class * classes = NULL; | |
numClasses = objc_getClassList(NULL, 0); | |
if (numClasses > 0 ) | |
{ | |
classes = malloc(sizeof(Class) * numClasses); | |
numClasses = objc_getClassList(classes, numClasses); | |
for (int i = 0; i < numClasses; i++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 参数可选(auto, ture, false) | |
$ git config --global color.status auto | |
$ git config --global color.diff auto | |
$ git config --global color.branch auto | |
$ git config --global color.interactive auto | |
$ git config --global color.ui auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 把一个wstring转化为string | |
std::string& to_string(std::string& dest, std::wstring const & src) | |
{ | |
std::setlocale(LC_CTYPE, ""); | |
size_t const mbs_len = wcstombs(NULL, src.c_str(), 0); | |
std::vector<char> tmp(mbs_len + 1); | |
wcstombs(&tmp[0], src.c_str(), tmp.size()); | |
dest.assign(tmp.begin(), tmp.end() - 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CCGLProgram* p = new CCGLProgram(); | |
p->initWithVertexShaderFilename("shader/BanishShader.vsh", "shader/BanishShader.fsh"); | |
p->addAttribute(kCCAttributeNamePosition, kCCVertexAttrib_Position); | |
p->addAttribute(kCCAttributeNameColor, kCCVertexAttrib_Color); | |
p->addAttribute(kCCAttributeNameTexCoord, kCCVertexAttrib_TexCoords); | |
p->link(); | |
p->updateUniforms(); | |
pSprite->setShaderProgram(p); | |
p->release(); |
OlderNewer