注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。
启动新会话:
tmux [new -s 会话名 -n 窗口名]
恢复会话:
// 寄生组合继承 (相对完美的继承范式) | |
// 父类 | |
function Animal (name) { | |
// 实例方法 | |
this.name = name | |
this.sleep = function () { | |
console.log(`${this.name} is sleeping...`) | |
} |
// Tiny Redux | |
export const combineReducers = reducers => { | |
return (state = {}, action) => { | |
return Object.keys(reducers).reduce( | |
(nextState, key) => { | |
nextState[key] = reducers[key](state[key], action) | |
return nextState | |
}, | |
{} |
enum LoggerLevel { | |
VERBOSE = 0, | |
DEBUG = 1, | |
INFO = 2, | |
WARN = 3, | |
ERROR = 4 | |
} | |
enum ConsoleMethod { | |
log = 'log', |
<script>!function(e,t){function n(){t.body?t.body.style.fontSize=12*o+"px":t.addEventListener("DOMContentLoaded",n)}function d(){var e=i.clientWidth/10;i.style.fontSize=e+"px"}var i=t.documentElement,o=e.devicePixelRatio||1;if(n(),d(),e.addEventListener("resize",d),e.addEventListener("pageshow",function(e){e.persisted&&d()}),o>=2){var a=t.createElement("body"),s=t.createElement("div");s.style.border=".5px solid transparent",a.appendChild(s),i.appendChild(a),1===s.offsetHeight&&i.classList.add("hairlines"),i.removeChild(a)}}(window,document);</script> |
const COUNT = 1000 * 1000 * 10 | |
function run (sum, fn) { | |
const startTime = Date.now() | |
for (let i = 0; i < COUNT; i++) { | |
sum = fn(sum) | |
} | |
console.log(`duration: ${Date.now() - startTime}`) | |
} |
// 反射 | |
package main | |
import ( | |
"errors" | |
"reflect" | |
"fmt" | |
) | |
func Call(m map[string]interface{}, name string, params ...interface{}) ([]reflect.Value, error) { |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title></title> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<script src="http://unpkg.qkcdn.com/lodash@4.17.4/lodash.min.js"></script> | |
<script src="http://unpkg.qkcdn.com/vue@2.4.2/dist/vue.min.js"></script> | |
</head> | |
<body> |
Create a module for vue component. |
/* http://meyerweb.com/eric/tools/css/reset/ | |
v2.0 | 20110126 | |
License: none (public domain) | |
*/ | |
html, body, div, span, applet, object, iframe, | |
h1, h2, h3, h4, h5, h6, p, blockquote, pre, | |
a, abbr, acronym, address, big, cite, code, | |
del, dfn, em, img, ins, kbd, q, s, samp, | |
small, strike, strong, sub, sup, tt, var, |