Skip to content

Instantly share code, notes, and snippets.

@yi
yi / gist:01e3ab762838d567e65d
Created July 24, 2014 18:52
lua hex <= => string
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 / LICENSE.txt
Created February 27, 2014 17:59 — forked from jed/LICENSE.txt
Fucking crazy UUID
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@yi
yi / open_app.html
Created February 22, 2017 08:46 — forked from noelrocha/open_app.html
Open app on Google Play or AppStore
<!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 October 20, 2016 16:22 — forked from WebReflection/fake-script.js
hot to mock script requests
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 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

@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'
/* 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 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 {
@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 / 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: 隐藏正在显示的活动指示器"