Instantly share code, notes, and snippets.

View index.ts
interface User {
username: string;
roles: string[];
}
interface Role {
name: string;
desc: string;
permission: Permission[];
}
View index.js
const babylon = require("babylon");
const types = require("babel-types");
const visitors = {
File(node, scope) {
evaluate(node.program, scope);
},
Program(program, scope) {
for (const node of program.body) {
evaluate(node, scope);
View main.go
package main
import (
"net/http"
"log"
"io/ioutil"
"encoding/json"
"bytes"
"strings"
)
View supershell.js
const { spawn, exec } = require('child_process');
const COMMAND = Symbol('command');
class Shell {
constructor(command) {
this[COMMAND] = [command];
}
}
const run = new Proxy(
View cycle.js
class Node {
constructor(prev, value, next) {
this.prev = prev;
this.next = next;
this.value = value;
}
}
const CURRENT_INDEX = Symbol('current index in cycle');
const ROUND_INDEX = Symbol('how many round in cycle');
View pool.go
package pool
type CreatorFunc func() (interface{}, error)
type DestroyerFunc func(resource interface{}) (interface{}, error)
type Pool struct {
config Config
options Options
pool []interface{}
}
View emitter.go
package pool
import "time"
type Event struct {
Time time.Time
Name string
Data interface{}
Id string
}
View hs.js
/**
* Generate a New status
* @param code
* @param message
* @constructor
*/
function Status(code, message) {
this.code = code;
this.message = message;
}
View README.md

NodeJs 项目目录

.
├── logs                                                        # 存放日志
│   ├── 1.log
│   └── 2.log
├── package.json                                                # 依赖包
├── scripts                                                     # 脚本集合
│   └── do_some_thing.js