This is a CFP for ReactiveConf open call for lightning talks. If you'd like to see this talk become a reality, please ⭐️ star this gist. #ReactiveConf
If you're on your phone, please request the desktop site to star this gist 😇
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
func getQueryStringParameter(url: String, param: String) -> String? { | |
let url = NSURLComponents(string: url)! | |
return | |
(url.queryItems? as [NSURLQueryItem]) | |
.filter({ (item) in item.name == param }).first? | |
.value() | |
} |
import { combineReducers } from 'redux'; | |
import users from './reducers/users'; | |
import posts from './reducers/posts'; | |
export default function createReducer(asyncReducers) { | |
return combineReducers({ | |
users, | |
posts, | |
...asyncReducers | |
}); |
import { combineReducers } from 'redux'; | |
import users from './reducers/users'; | |
import posts from './reducers/posts'; | |
// Inject the initial state for async loaded reducers | |
function injectState(reducers, preloadedState = {}) { | |
return Object.keys(reducers).reduce((finalReducers, key) => { | |
if (typeof reducers[key] === "function") { | |
finalReducers[key] = (state = preloadedState[key], action) => reducers[key](state, action); | |
} |
This is a CFP for ReactiveConf open call for lightning talks. If you'd like to see this talk become a reality, please ⭐️ star this gist. #ReactiveConf
If you're on your phone, please request the desktop site to star this gist 😇
import createHoverMonitor from './createHoverMonitor'; | |
import { element, func, oneOfType } from 'prop-types'; | |
import React, { Component } from 'react'; | |
const hover = createHoverMonitor(); | |
/** | |
* Use: | |
* <Hoverable> | |
* {(hover) => <View style={hover && styles.hovered} />} |