Skip to content

Instantly share code, notes, and snippets.

@yi
yi / open_app.html
Created Feb 22, 2017 — forked from noelrocha/open_app.html
Open app on Google Play or AppStore
View open_app.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Open App</title>
<!--
URL Params:
customSchemeURL: Your custom scheme app
@yi
yi / fake-script.js
Created Oct 20, 2016 — forked from WebReflection/fake-script.js
hot to mock script requests
View fake-script.js
document.createElement = function (
createElement, // the native one
createResponse // the function "in charge"
) {
return function (nodeName) {
var result, src;
// if we are creating a script
if (/^script$/i.test(nodeName)) {
// result will be a place holder
result = createElement.call(
@yi
yi / nix_command.md
Created Feb 11, 2016
常用的unix指令集合
View nix_command.md

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

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

View StageResizer.js
/* 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 / bpt.scale9.ts
Created Sep 30, 2015 — forked from lardratboy/bpt.scale9.ts
Phaser Scale9 sprite supports tiled or basic scaling
View bpt.scale9.ts
// 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 {
View gist:01e3ab762838d567e65d
function string.fromhex(str)
return (str:gsub('..', function (cc)
return string.char(tonumber(cc, 16))
end))
end
function string.tohex(str)
return (str:gsub('.', function (c)
return string.format('%02X', string.byte(c))
end))
@yi
yi / lua.snippets
Created Jun 21, 2014
Quick-x lua snippets for Vim SnippetMate
View lua.snippets
#################################
# Snippets for the Lua language #
#################################
##### quick-x support : start ####
snippet device.showActivityIndicator "quickx: 显示活动指示器"
device.showActivityIndicator()
snippet device.hideActivityIndicator() "quickx: 隐藏正在显示的活动指示器"
@yi
yi / _vimrc
Last active Aug 29, 2015
my _vimrc
View _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 / gist:9151fdd93883c7b7f106
Created May 12, 2014
JS: generate a color value from arbitery given string
View gist:9151fdd93883c7b7f106
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 / gist:10020432
Created Apr 7, 2014
cocos 脚本的参数
View gist:10020432
语言:
CPP = 'cpp'
LUA = 'lua'
JS = 'js'
OS:
ANDROID = 'android'
IOS = 'ios'
MAC = 'mac'
You can’t perform that action at this time.