- C-a == Ctrl-a
- M-a == Alt-a
:q close
:w write/saves
:wa[!] write/save all windows [force]
:wq write/save and close
function timeAgo(time){ | |
var units = [ | |
{ name: "second", limit: 60, in_seconds: 1 }, | |
{ name: "minute", limit: 3600, in_seconds: 60 }, | |
{ name: "hour", limit: 86400, in_seconds: 3600 }, | |
{ name: "day", limit: 604800, in_seconds: 86400 }, | |
{ name: "week", limit: 2629743, in_seconds: 604800 }, | |
{ name: "month", limit: 31556926, in_seconds: 2629743 }, | |
{ name: "year", limit: null, in_seconds: 31556926 } | |
]; |
Ext.Date.fuzzy = function(time, local){ | |
(!local) && (local = Date.now()); | |
if (typeof time !== 'number' || typeof local !== 'number') { | |
return; | |
} | |
var | |
offset = Math.abs((local - time)/1000), |
/* ========================================================= | |
Comments | |
========================================================= */ | |
ol.commentlist { | |
list-style:none; | |
margin:0 0 1em; | |
padding:0; | |
text-indent:0; |
Press minus + shift + s
and return
to chop/fold long lines!
var spawn = require('child_process').spawn; | |
var csp = require('js-csp'); | |
class Math { | |
constructor(readyCallback) { | |
this._readyCallback = readyCallback; | |
this._worker = spawn('6to5-node', ['worker.js']); | |
this._worker.stderr.pipe(process.stderr); | |
this._reqChan = csp.chan(); |
Usable mainly when reducer is more like assembler for your data store changes, and main logic is put into action. So you often need to dispatch multiple smaller action, but to keep it atomic, they have to be processed in a single reduce step. This is the solution. The bonus is, it works well with devTools also.
export function multipleActionsEnhanceReducer(reducer) {
return (state, action, ...rest) => {
if (action.actions && action.actions.type && action.actions instanceof Array) {
state = action.actions.reduce(reducer, state);
} else {
// Epochs | |
const epochs = [ | |
['year', 31536000], | |
['month', 2592000], | |
['day', 86400], | |
['hour', 3600], | |
['minute', 60], | |
['second', 1] | |
]; |
// inifinite scrolling of content without extra wrappers | |
const { render, findDOMNode } = ReactDOMFiber | |
class App extends React.Component { | |
render() { | |
// wrap the root element with an Intersection Observer, exposing .observe for children | |
return <Intersection> | |
<div style={{ height: 200, overflow: 'auto' }}> | |
<Page offset={0} count={10} /> | |
</div> |
//compose from redux/compose.js | |
function compose(...funcs) { | |
console.info("$$$ compose function ") | |
console.dir( funcs) | |
if (funcs.length === 0) { | |
return arg => arg | |
} | |
if (funcs.length === 1) { | |
return funcs[0] |