View monotonically-increasing.js
const helpers = {
*monotonicallyIncreasingGen(start, step) {
var counter = start;
while (true) {
yield counter;
counter += step;
}
},
View redux-saga-readme-translated
#### note
translate https://github.com/yelouafi/redux-saga/blob/7da88a9096268ed70cfd9e6f0a54454274ad5ddd/README_zh-hant.md
using google translate
# Redux-saga
[! [Npm version] (https://img.shields.io/npm/v/redux-saga.svg?style=flat-square)] (https://www.npmjs.com/package/redux-saga )
Another Side Effect model Redux app. Instead of thunk redux-thunk sent. You can create * * Sagas in one place to focus all Side Effect logic.
View fetch-wrapper.js
var api_fetch = {
checkStatus(response) {
if (response.status >= 200 && response.status < 300) {
return Promise.resolve(response);
} else {
return Promise.reject(response);
}
},
parseJson(response) {
View notes.txt
when you do not need a router
then we can escape by mounting and unmounting components manually
also can we hook `history.js` into mount and unmount to get a stupid router ?
View image-slider.jsx
var App = React.createClass({
getInitialState: function() {
return {
red: 0,
green: 0,
blue: 0
};
},
update: function() {
View babel-output.js
"use strict";
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var state = {
loggedIn: false
};
var newState = _extends({}, state, {
loggedIn: "test"
View start-node.sh
## Install [node](http://nodejs.org) via [homebrew](http://brew.sh) and update [npm](https://www.npmjs.com)
# install node version with LTS (Long Term Support)
brew install node4-lts
# update npm
npm install npm -g
# check versions
node -v
View benchmark.ruby-set-and-array-unique-insert.rb
require 'benchmark'
require 'set'
NUMBERS = 5000.times.collect { rand(10) }
Benchmark.bmbm do |x|
x.report("set") do
set = Set.new
NUMBERS.each do |number|
set.add number
View rails-aws-app-setup-and-install.sh.txt
# provisioning a rails stack with
# - ngixn web server and reverse proxy
# - puma app server
# - redis
# - elasticsearch
# - Amazon RDS using etc for the SQL database
# installed on an AWS EC2 instance running Ubuntu 14.04 LTS
# fix locale.
# needed to remove login warning
View docs confused why we need `extern crate` and use both.txt
as a rust noob and coming from ruby
was confused why we need `extern crate` and `use` both ?
the `guessing-game` chapter has these two paragraphs:
```
The first thing we’ve done is change the first line. It now says
`extern crate rand`. Because we declared `rand` in our `[dependencies]`, we
can use `extern crate` to let Rust know we’ll be making use of it. This also
does the equivalent of a `use rand;` as well, so we can make use of anything