Skip to content

Instantly share code, notes, and snippets.

@yi
yi / gist:9172832
Last active August 29, 2015 13:56
git aliases
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.unstage 'reset HEAD --'
git config --global alias.last 'log -1 HEAD'
git config --global alias.df 'diff'
@yi
yi / gist:10020432
Created April 7, 2014 13:36
cocos 脚本的参数
语言:
CPP = 'cpp'
LUA = 'lua'
JS = 'js'
OS:
ANDROID = 'android'
IOS = 'ios'
MAC = 'mac'
@yi
yi / gist:9151fdd93883c7b7f106
Created May 12, 2014 10:46
JS: generate a color value from arbitery given string
function hashCode(str) { // java String#hashCode
var hash = 0;
for (var i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
return hash;
}
function intToARGB(i){
var resualt = ""
@yi
yi / _vimrc
Last active August 29, 2015 14:02
my _vimrc
set showcmd " display incomplete commands
set showmode " display the current editing mode
"set cursorcolumn " 高亮当前光标所在列
set cursorline " 高亮当前光标所在行
"hi CursorColumn cterm=NONE ctermbg=darkred ctermfg=white guibg=NONE guifg=NONE
" get rid of the F1 help
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
@yi
yi / lua.snippets
Created June 21, 2014 17:28
Quick-x lua snippets for Vim SnippetMate
#################################
# Snippets for the Lua language #
#################################
##### quick-x support : start ####
snippet device.showActivityIndicator "quickx: 显示活动指示器"
device.showActivityIndicator()
snippet device.hideActivityIndicator() "quickx: 隐藏正在显示的活动指示器"
@yi
yi / gist:1362270
Created November 13, 2011 16:13
VIM settings for JavaScript editing

VIM settings for JavaScript

VIM 用户环境

Windows

  • 配置文件: %HOMEPATH%/_vimrc
  • 插件目录: %HOMEPATH%/vimfiles/
@yi
yi / bpt.scale9.ts
Created September 30, 2015 18:59 — forked from lardratboy/bpt.scale9.ts
Phaser Scale9 sprite supports tiled or basic scaling
// Author Brad P. Taylor (bradptaylor+github@gmail.com) license MIT
///<reference path="../../../../bower_components/phaser-official/build/phaser.d.ts"/>
///<reference path="./prefab.ts"/>
// TODO - support PIXI.Texture/BaseTexture/Atlas (if texture then use inner texture)
// TODO - error checking ? possibly correct bad snap requests (not multiple)
module bpt {
export class Scale9 extends Phaser.Group {
/* global window */
function StageResizer (stageElement, options) {
options = options || {};
this._element = stageElement;
this._stageWidth = options.stageWidth || stageElement.offsetWidth || 1;
this._stageHeight = options.stageWidth || stageElement.offsetWidth || 1;
this._snapToEdge = options.snapToEdge || true;
@yi
yi / coff-kue-redis-createClient
Last active December 27, 2015 02:19
coffeescript kue redis createClient with custom host and port
## 更新外部配置
p.version('0.0.1')
.option('-p, --port <n>', 'redis server port')
.option('-h, --host [VALUE]', 'redis server host')
.parse(process.argv)
p.port = parseInt(p.port) || 6379
p.host = p.host || "localhost"
kue = require 'kue'
@yi
yi / nix_command.md
Created February 11, 2016 06:29
常用的unix指令集合

在长文本中显示指定的行号的行内容

Example 1: Display specific lines (based on line number) of a file using sed command

View only the specific lines mentioned by line numbers.

Syntax:

$ sed -n -e Xp -e Yp FILENAME