Skip to content

Instantly share code, notes, and snippets.

View otakustay's full-sized avatar

Gray Zhang otakustay

  • Long lives alien!
  • Shanghai China
View GitHub Profile
@otakustay
otakustay / surge.conf
Created October 26, 2015 07:33 — forked from icodesign/surge.conf
surge.conf
[General]
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, localhost, *.local
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
dns-server = 119.29.29.29, 223.5.5.5, 114.114.114.114
loglevel = notify
[Proxy]
Proxy = custom
[Rule]
@otakustay
otakustay / plan-list.json
Last active November 16, 2015 09:20
interface declaration
"requestSchema": {
"protocol": "http",
"args": {
"pageSize": {
"type": "number",
"description": "页码",
"requried": false,
"defaultValue": 1
},
"keyword": {
@otakustay
otakustay / private.js
Created December 10, 2015 06:33
private implement
// 存放类的私有字段和对应`Symbol`的映射
let pirvateSymbols = new Map();
let addPrivateSymbol = (klass, key, defualtValue) => {
let symbol = new Symbol(key);
let symbols = pirvateSymbols.get(klass) || {};
symbols[symbol] = defualtValue;
pirvateSymbols.set(klass, symbols);
};
@otakustay
otakustay / biz.js
Last active March 7, 2016 05:56
decorator as advice
import Service from './Service';
import {log} from './decorator';
// May use https://github.com/jayphelps/core-decorators.js
import {deprecate, throttle} from 'core-decorators';
import {forClass} from 'aop';
let MyService = forClass(
Service,
{
aspects: [
@otakustay
otakustay / 403.headers
Last active April 11, 2018 11:53
nginx headers
HTTP/1.1 403 Forbidden
Server: nginx
Date: Tue, 29 Mar 2016 06:36:47 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Content-Encoding: gzip
@otakustay
otakustay / default.js
Created June 8, 2016 08:27
emc.Model.js
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(['exports', 'diffy-update', 'diffy-update/merge', 'diffy-update/diffNode', 'mini-event/EventTarget'], factory);
} else if (typeof exports !== "undefined") {
factory(exports, require('diffy-update'), require('diffy-update/merge'), require('diffy-update/diffNode'), require('mini-event/EventTarget'));
} else {
var mod = {
exports: {}
};
factory(mod.exports, global.diffyUpdate, global.merge, global.diffNode, global.EventTarget);
@otakustay
otakustay / shell
Created June 13, 2016 07:13
icode log
~/Dev/jingyi(branch:infrastructure-enhance*) » git push origin infrastructure-enhance:refs/for/develop otakustay@Gray-MacBook-Pro
Counting objects: 16, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (15/15), done.
Writing objects: 100% (16/16), 2.67 KiB | 0 bytes/s, done.
Total 16 (delta 13), reused 0 (delta 0)
remote: Resolving deltas: 100% (13/13)
remote: Processing changes: (\)
remote: Processing changes: new: 1, refs: 1, done
remote:
@otakustay
otakustay / result.txt
Created June 27, 2016 08:02
mysql in
mysql> show columns in `order`;
+----------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+---------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| product | int(11) | NO | | NULL | |
| quantity | int(11) | NO | | NULL | |
+----------+---------+------+-----+---------+----------------+
3 rows in set (0.01 sec)
@otakustay
otakustay / 1-schema.js
Last active July 3, 2016 04:21
Schema validation merge
let schema = {
type: 'object',
description: '推广单元表单',
properties: {
campaignId: {
type: 'string',
description: '营销活动'
},
platformId: {
type: 'string',
class Component {
render() {
return this.renderWithTemplate(this.state);
}
initializeEvent(element, name, expession) {
element.addEventListener(name, generateEventHandler(this[name], expression), false)
}
}