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
#!/bin/bash | |
# | |
# Parses DHCP options from openvpn to update resolv.conf | |
# To use set as 'up' and 'down' script in your openvpn *.conf: | |
# up /etc/openvpn/update-resolv-conf | |
# down /etc/openvpn/update-resolv-conf | |
# | |
# Used snippets of resolvconf script by Thomas Hood and Chris Hanson. | |
# Licensed under the GNU GPL. See /usr/share/common-licenses/GPL. | |
# |
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
const EventEmitter = require('events') | |
const electron = require('electron') | |
export default class EventBus extends EventEmitter { | |
constructor(name='default') { | |
super() | |
this._name = name | |
this._baseEventKey = `EventBus-${name}:` | |
} |
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
// @flow | |
import shave from 'shave' | |
import { h, Component } from 'preact' | |
import shallowCompare from 'shallow-compare' | |
type Props = { | |
line?: number, | |
text: string, | |
ellipsis?: string, | |
onEllipsisClick?: ?MouseEventListener, |
OlderNewer