构建一个可用的内存缓存.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Auto detect text files and perform LF normalization | |
* text=auto | |
# JS and TS files must always use LF for tools to work | |
*.js eol=lf | |
bin/* eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Koa = require('koa'); | |
const Router = require('koa-router'); | |
const methods = require('methods'); | |
const router = new Router(); | |
const KOA = Symbol('koa instance'); | |
class Server { | |
constructor() { | |
this[KOA] = new Koa(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hashCode(any) { | |
let hash = 0; | |
if ( | |
any === null || | |
any === void 0 || | |
any === '' || | |
any === 0 || | |
any === false | |
) { | |
return 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Generate a New status | |
* @param code | |
* @param message | |
* @constructor | |
*/ | |
function Status(code, message) { | |
this.code = code; | |
this.message = message; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pool | |
import "time" | |
type Event struct { | |
Time time.Time | |
Name string | |
Data interface{} | |
Id string | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { spawn, exec } = require('child_process'); | |
const COMMAND = Symbol('command'); | |
class Shell { | |
constructor(command) { | |
this[COMMAND] = [command]; | |
} | |
} | |
const run = new Proxy( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"net/http" | |
"log" | |
"io/ioutil" | |
"encoding/json" | |
"bytes" | |
"strings" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface User { | |
username: string; | |
roles: string[]; | |
} | |
interface Role { | |
name: string; | |
desc: string; | |
permission: Permission[]; | |
} |