react + redux + RR
It uses https://gist.github.com/iNikNik/3c1b870f63dc0de67c38 for stores and actions.
1) create redux
const redux = createRedux(state);
2) get requireAccess func => bindCheckAuth to redux
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }' | |
import { createStore, applyMiddleware } from 'redux'; | |
import { Observable, Subject } from 'rxjs'; | |
const api = (url, fail) => { | |
console.log(`Loading API ${url}`); | |
return new Promise((res, rej) => setTimeout(() => fail ? rej(`data-${url}`) : res('SUCCESS'), 1000)); | |
}; | |
const customSaga = iterable => | |
iterable |
#!/usr/bin/env bash | |
set -e | |
## Developer Environment | |
# setup | |
mkdir -p ~/setup | |
cd ~/setup |
react + redux + RR
It uses https://gist.github.com/iNikNik/3c1b870f63dc0de67c38 for stores and actions.
1) create redux
const redux = createRedux(state);
2) get requireAccess func => bindCheckAuth to redux
// UPD: | |
// Now available as npm module! | |
// Check out https://github.com/RReverser/better-log for details. | |
console.log = (function (log, inspect) { | |
return function () { | |
return log.apply(this, Array.prototype.map.call(arguments, function (arg) { | |
return inspect(arg, { depth: 1, colors: true }); | |
})); | |
}; |
The 0.13.0
improvements to React Components are often framed as "es6 classes" but being able to use the new class syntax isn't really the big change. The main thing of note in 0.13
is that React Components are no longer special objects that need to be created using a specific method (createClass()
). One of the benefits of this change is that you can use the es6 class syntax, but also tons of other patterns work as well!
Below are a few examples creating React components that all work as expected using a bunch of JS object creation patterns (https://github.com/getify/You-Dont-Know-JS/blob/master/this%20&%20object%20prototypes/ch4.md#mixins). All of the examples are of stateful components, and so need to delegate to React.Component
for setState()
, but if you have stateless components each patterns tends to get even simpler. The one major caveat with react components is that you need to assign props
and context
to the component instance otherwise the component will be static. The reason is
// thanks to @raganwald | |
function spread(fn) { | |
return Function.apply.bind( fn, null ); | |
} | |
function foo(x,y,z) { | |
console.log(x,y,z); | |
} | |
function bar(fn) { |
This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.
A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:
This class forces video to load on 100% and informs about it's load progress.
Important notes:
buffered / videoDuration == 100
. Even rounding to precision of 2 fails in IE