Skip to content

Instantly share code, notes, and snippets.

View tmux-cheatsheet.markdown

Tmux 快捷键 & 速查表

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

tmux at [-t 会话名]
View tmux-cheatsheet.markdown

Tmux 快捷键 & 速查表

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

tmux at [-t 会话名]
View example.js
const Koa = require('./koa');
const app = new Koa();
// logger
app.use(async function (ctx, next) {
const start = new Date();
await next();
const ms = new Date() - start;
console.log(`${ctx.method} ${ctx.url} - ${ms}`);
});
View javascript fun
/*
* 根据传入的数字,返回其中包含的最大的连续五位数
* e.g.
* maxFiveDigits(283910356876) // =>91035
* maxFiveDigits(123456) // => 23456
*/
function maxFiveDigits(num) {
//TODO:完成该函数
}
View judge array
/**
* 判断类型
* @module filters/is
* @param {Any} value - 待检测类型的对象
* @param {sting} type - 类型:`array`, `object`, `boolean`, `string`, `number`, `undefined`
* 多个用逗号分隔
* @return {Boolean}
*/
export function is(value, types) {
let correct = false;
@luxiaojian
luxiaojian / everything.html
Created Apr 1, 2016 — forked from CarterLi/everything.html
很牛B的html代码,丢进去没错的
View everything.html
<!-- 适应移动端start -->
<meta name="format-detection" content="telephone=no, email=no" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" /><!-- 删除苹果默认的工具栏和菜单栏 -->
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /><!-- 设置苹果工具栏颜色 -->
<meta name="format-detection" content="telphone=no, email=no" /><!-- 忽略页面中的数字识别为电话,忽略email -->
<!-- 启用360浏览器的极速模式(webkit) -->
<meta name="renderer" content="webkit" />
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
@luxiaojian
luxiaojian / dialog
Created Jan 26, 2016
angular-dialog-service
View dialog
class Dialog {
constructor(services) {
this.services = services;
}
init({controller, controllerAs, scope}) {
var { $controller } = this.services;
var ctrl = $controller(controller, { scope });
var dialog = {
View index.html
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>html5拖拽</title>
<style id="jsbin-css">
.clearfix:before,
.clearfix:after{
display: table;
content: '';
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<p id="adom">adom</p>
<a href="#">link</a>
<p class="name">name</p>
@luxiaojian
luxiaojian / gist:cf3f4a76a2b2d3376f6c
Created Apr 21, 2015
wordpress前端调用文章缩略图
View gist:cf3f4a76a2b2d3376f6c
<?php
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($thumb_id,'thumbnail-size', true);//thumbnail-size:thumbnail,medium,large,full
echo $thumb_url[0];
?>