Skip to content

Instantly share code, notes, and snippets.

View hiyangguo's full-sized avatar
:octocat:
Everything is possible

Godfery Yang hiyangguo

:octocat:
Everything is possible
View GitHub Profile
@hiyangguo
hiyangguo / temp-example.js
Created June 17, 2016 03:18
Basic temp example
/*
type config = {
args: {
Query参数名称 : 预定义类型 或 Converter
}
}
type 预定义类型 = 'Int' | 'String'
type Converter = function(queryParamValue):Promise
```javascript
var tasks = [1, 2, 3, 4, 5];
tasks = tasks.map(function(i) {
return function(cb) {
setTimeout(function() {
console.log(i);
cb();
}, Math.random() * 500 | 0);
}
});
@hiyangguo
hiyangguo / test.html
Created September 2, 2016 05:41
改变默认title样式
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset=gbk />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<style>
div{
margin:10 auto;
width:200px;
@hiyangguo
hiyangguo / 秒转时分秒.js
Created September 6, 2016 09:33
秒转HH:mm:ss
function getTime(second) {
var s = second % 60;
var m = Math.floor(second / 60);
var h = m < 60 ? 0 : Math.floor(m / 60);
m = m >= 60 ? Math.floor(m % 60) : m;
var format = function(num) {
return num > 9 ? num : '0' + num;
};
return [h, m, s].map(function(t) {
@hiyangguo
hiyangguo / raffle.js
Created September 7, 2016 06:30
宁JS抽奖程序
#!/usr/bin/env node
'use strict'
const fs = require('fs')
const path = require('path')
const blessed = require('blessed')
const contrib = require('blessed-contrib')
const screen = blessed.screen()
const grid = new contrib.grid({rows: 2, cols: 5, screen: screen})
@hiyangguo
hiyangguo / parseTreeObjToLine.js
Last active September 23, 2016 09:35
parse {a:{b:1}} to {a.b:1}
var test = {
id: 1,
user: {
role: [1, 2, 3, 4],
userGroup: {
id: 1
},
name: {
first: "foo",
last: "bar"
@hiyangguo
hiyangguo / config.md
Created October 12, 2016 02:28
echarts 3.x 地图问题配置
option={
    "color": [
        "#fe8463",
        "#9bca63",
        "#fad860",
        "#60c0dd",
        "#0084c6",
        "#d7504b",
        "#c6e579",
@hiyangguo
hiyangguo / sankey-config.js
Created October 12, 2016 13:35
echarts sankey config
option = {
"title": {
"x": "center",
"y": "20",
"textStyle": {
"color": "#999",
"fontWeight": "100"
},
"text": "来源分析"
},
@hiyangguo
hiyangguo / README.md
Created November 25, 2016 07:54 — forked from rowanmanning/README.md
Writing a Friendly README. This a companion-gist to the post: http://rowanmanning.com/posts/writing-a-friendly-readme/
@hiyangguo
hiyangguo / 计算数组的和.js
Last active December 8, 2016 03:50
数组求和
/**
* Created by Godfery on 2016/12/8.
*/
/**
* Created by Godfery on 2016/12/7.
*/
var a = [['bj', 1, 'sh', 2, 'wh', 3], ['gz', 4, 'bj', 5], ['sh', 6], ['sh', 5]];
/**
* 获取数组聚合
* @param array