Skip to content

Instantly share code, notes, and snippets.

View keenwon's full-sized avatar
😆
lol

Keenwon keenwon

😆
lol
View GitHub Profile
@keenwon
keenwon / output.txt
Created January 20, 2019 11:19
nyc issue
v11.7.0
6.5.0
koa-subdomain@2.4.0 /home/keenwon/Code/koa-subdomain
├─┬ chai@4.2.0
│ ├── assertion-error@1.1.0
│ ├── check-error@1.0.2
│ ├─┬ deep-eql@3.0.1
│ │ └── type-detect@4.0.8 deduped
│ ├── get-func-name@2.0.0
│ ├── pathval@1.1.0
@keenwon
keenwon / unistore.js
Created November 22, 2017 02:05 — forked from developit/unistore.js
dead simple centralized state container ("store"), with preact bindings.
import { h, Component } from 'preact';
/** Creates a new store, which is a tiny evented state container.
* @example
* let store = createStore();
* store.subscribe( state => console.log(state) );
* store.setState({ a: 'b' }); // logs { a: 'b' }
* store.setState({ c: 'd' }); // logs { c: 'd' }
*/
@keenwon
keenwon / radar.html
Created May 12, 2017 07:54
canvas 雷达动画
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Canvas · 雷达动画</title>
<style>
* {
margin: 0;
padding: 0;
@keenwon
keenwon / loading.js
Created March 26, 2017 07:40
terminal进度条
const readline = require('readline');
// 百分比
let percentage = 0;
// 时长
let time = 5 * 1000;
// 频率
let frequency = 50;
// 步长
let step = 1 / (time / frequency);
@keenwon
keenwon / loadingbar.html
Created July 3, 2016 05:38
loading bar
<!doctype html>
<html lang="zh-CN">
<head>
<title>Loading bar</title>
<meta charset="utf-8">
<style type="text/css">
.loadingbar {
position: fixed;
z-index: 2147483647;
top: 0;
@keenwon
keenwon / redux-middleware-test.html
Created June 29, 2016 03:43
redux middleware test
<!doctype HTML>
<html>
<head>
<title>Redux Test</title>
</head>
<body>
<script src="https://npmcdn.com/redux@3.5.2/dist/redux.js"></script>
<script>
// actions
const ADD = 'ADD';
@keenwon
keenwon / .gitconfig
Created March 10, 2016 11:08
Pretty git branch graphs
[alias]
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
@keenwon
keenwon / css3.html
Last active December 21, 2015 08:19
一些CSS3动画效果
<!doctype html>
<!--[if lte IE 9]>
<html lang="zh-CN">
<![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html lang="zh-CN" class="css3">
<!--<![endif]-->
<head>
<title>test</title>
<style>
@keenwon
keenwon / loadCss.js
Created October 22, 2015 01:52
js动态加载css
'use strict';
module.exports = function (cssText) {
if (!cssText) {
return;
}
var head = document.head || document.getElementsByTagName('head')[0],
style = document.createElement('style');
@keenwon
keenwon / spider.js
Last active August 29, 2015 14:17
Nodejs实现的简易网页抓取程序,支持代理(抓取墙外的资源)
var fs = require('fs'),
path = require('path'),
filePath = path.join(__dirname, 'log.txt'), //抓取结果写入log.txt文件
http = require('http');
var page = 1, //开始页码
maxPage = 100, //结束页码
search,
next,
run;