View unistore.js
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' }
*/
View index.js
let userLessEntity = new Entity('userLess', {}, {
fields: ['name', 'email']
});
let userDetailEntity = new Entity('userDetail', {}, {
fields: ['age', 'location']
});
let userEntity = userLessEntity.union(userDetailEntity);
View radar.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Canvas · 雷达动画</title>
<style>
* {
margin: 0;
padding: 0;
View loading.js
const readline = require('readline');
// 百分比
let percentage = 0;
// 时长
let time = 5 * 1000;
// 频率
let frequency = 50;
// 步长
let step = 1 / (time / frequency);
View loadingbar.html
<!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;
View redux-middleware-test.html
<!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';
View .gitconfig
[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"
View css3.html
<!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>
View loadCss.js
'use strict';
module.exports = function (cssText) {
if (!cssText) {
return;
}
var head = document.head || document.getElementsByTagName('head')[0],
style = document.createElement('style');
View spider.js
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;