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
# Path to your oh-my-zsh installation. | |
export ZSH=/home/z/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
ZSH_THEME="steeef" | |
# Uncomment the following line to use case-sensitive completion. |
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
var _CommentInput = React.createClass({ | |
propTypes: { | |
atUser: PropTypes.string, | |
placeholder: PropTypes.string, | |
focus: false, | |
onEnter: PropTypes.func, | |
onChange: PropTypes.func | |
}, | |
getDefaultProps: function () { |
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 truncHtml(html, truncNum) { | |
if (!truncNum) { | |
return 0 | |
} | |
let sum = 0, index = 0 | |
;('>'+html+'<').replace(/>([^<>]*)</g, (ma, g1, offset, str) => { | |
g1 = g1.trim() | |
if (sum - 1 < truncNum && sum + g1.length - 1 >= truncNum) { | |
index = offset + (truncNum - sum) - 1 | |
console.log(index, offset, sum) |
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
let syncPromise | |
export default function syncMiddleware () { | |
return async (ctx, next) => { | |
if (ctx.isSync) { // 可以通过 decorator 实现 | |
if (!syncPromise) { | |
syncPromise = next() | |
await syncPromise | |
} else { | |
syncPromise = syncPromise.then(next) |
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
// @import './jsonh.es6'; | |
const StoreUtil = (function () { | |
// http://crocodillon.com/blog/always-catch-localstorage-security-and-quota-exceeded-errors | |
function isQuotaExceeded(e) { | |
var quotaExceeded = false | |
if (e) { | |
if (e.code) { | |
switch (e.code) { | |
case 22: |
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
/** | |
* SimpleRouter | |
* | |
*```js | |
* const routes = [{ | |
* path: '/', | |
* component: Main, | |
* }, { | |
* path: '/user/:id', | |
* component: User, |
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
{"0.3984699617225185":"-----BEGIN PGP PUBLIC KEY BLOCK-----\r\nCharset: UTF-8\r\n\r\nxv8AAABSBAAAAAATCCqGSM49AwEHAgME4JCeuCGhYIjKLhTDOXe1o8KbD0OgTBUy\r\nN2tFDZHROjL+ZRIPeqCym03m+iiTysgp71Qszl764+nlI5u4sSyqZ83/AAAACDxn\r\naXRodWI+wv8AAACOBBATCABA/wAAAAWCWQFVXv8AAAACiwn/AAAACZCUFR1PQAQi\r\ntv8AAAAFlQgJCgv/AAAABJYDAQL/AAAAApsD/wAAAAKeAQAAXXYBANoYKPXoiTbd\r\nY56ithXekpS18vVi0zR6J/VtiT5+of+GAP9VgVUTKk/19vBityNvHxh198iqShSu\r\nlC66kj3niDwPgs7/AAAAVgQAAAAAEggqhkjOPQMBBwIDBJkY2u9+S26cM0/cvRP+\r\nEpMzoxOdK3N8jeqhC2y1dRzLl2ZiB5OtrG3m1mB8GhmxeQwM2/qk+/YTohPAh6oH\r\nF04DAQgHwv8AAABtBBgTCAAf/wAAAAWCWQFVXv8AAAAJkJQVHU9ABCK2/wAAAAKb\r\nDAAA7ygA+gLSZjpYh6iTUdf8hI59KBYxyIaKoDlK1l3xiYzyO/8CAQCpoC5jrAs2\r\nu8tKlJEmChqWKPeKGJp+J6MUFn6TCnHO0g==\r\n=tu8N\r\n-----END PGP PUBLIC KEY BLOCK-----\r\n"} |
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 doHash(str, seed) { | |
var m = 0x5bd1e995; | |
var r = 24; | |
var h = seed ^ str.length; | |
var length = str.length; | |
var currentIndex = 0; | |
while (length >= 4) { | |
var k = UInt32(str, currentIndex); | |
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
import { Struct } from 'immuter' | |
const struct = Struct({ | |
title: { | |
zh: '哈利·波特与魔法石', | |
en: 'Harry Potter and the Philosopher\'s Stone', | |
}, | |
author: 'J. k. rowling', | |
tags: ['novel', 'magic'], | |
}) |
OlderNewer