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 / enum.js
Created October 18, 2013 16:37
javascript enum type
/**
* ADM 2.0
* Copyright 2013 Baidu Inc. All rights reserved.
*
* @file 常量枚举类
* @author wangyaqiong(catkin2009@gmail.com)
* @date $DATE$
*/
define(
function () {
@otakustay
otakustay / wrong-javascript-code-style.js
Created November 28, 2013 19:54
错误的javascript写法
var fs = require('fs-extra');
var GitHubAPI = require('github');
console.log('Request archive link for er');
var github = new GitHubAPI({ version: '3.0.0' });
github.repos.getArchiveLink(
{
user: 'ecomfe',
repo: 'er',
archive_format: 'zipball',
@otakustay
otakustay / npm-error.txt
Last active December 29, 2015 20:18
npm breaks itself
Gray's MacBook Pro:Dev otakustay$ sudo npm update -g
npm http GET https://registry.npmjs.org/edp
npm http GET https://registry.npmjs.org/npmrc
npm http GET https://registry.npmjs.org/istanbul
npm http GET https://registry.npmjs.org/less
npm http GET https://registry.npmjs.org/o3o
npm http GET https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/yeti
npm http GET https://registry.npmjs.org/npm
npm http 304 https://registry.npmjs.org/npmrc
@otakustay
otakustay / build-config.js
Created March 4, 2014 05:47
模块合并
/**
* @file build默认配置
* @author errorrik[errorrik@gmail.com]
*/
var AddViewName = require('./tool/build/AddViewName');
var package = require('./tool/util').getModulesFromPackage;
var namespace = require('./tool/util').getModulesFromNamespace;
var getBizNamespaces = require('./tool/util').getBizNamespaces;
@otakustay
otakustay / Base.js
Created March 7, 2014 05:37
构造函数式数据源合并
var LOAD_ENTITY = {
entity: function (model) {
return model.findById(model.get('id'));
}
};
var TRANSLATE_NAME = {
name: function (model) {
return mode.get('lastName') + ' ' + model.get('firstName');
}
@otakustay
otakustay / build.js
Created March 26, 2014 09:19
build with svn revision
var svnInfoOutput = '';
var svnInfo = require('child_process').exec(
'svn info',
function (err) {
var svnRevision;
if (err) {
// 如果没装svn命令行,获取不到版本号,就用时间戳了
svnRevision = +new Date();
console.warn(
'\033[31m'
@otakustay
otakustay / esui-next.md
Last active August 29, 2015 13:58
ESUI Next
  1. 更适合MVVM模型的架构

     <ui-text-box data-ui-value="~name"></ui-text-box>
    
     <script>
         var Model = require('model/Model');
         var user = new Model();
         user.set('name', 'foo');
    

require('esui-next').init(document.body, { model: user });

@otakustay
otakustay / for-edp-1.0.svn.patch
Created April 11, 2014 06:30
SVN patch for cb-web-fe to upgrade to edp 1.0
Index: .jshintignore
===================================================================
--- .jshintignore (revision 0)
+++ .jshintignore (working copy)
@@ -0,0 +1,3 @@
+!src/**
+src/external/**
+
Index: build.sh
===================================================================
@otakustay
otakustay / output.txt
Last active August 29, 2015 14:00
less error
~/Dev/test ⌚ 14:26:44
$ tree
.
├── bar
│   └── b.less
└── foo
└── a.less
2 directories, 2 files
@otakustay
otakustay / constructor.js
Last active August 29, 2015 14:01
Table config
function XxxListView() {
// super()
var tableFields = [
{
// ...
}
];
this.setTableFields(tableFields);
}