Map | Action |
---|---|
<F1> | Causes Netrw to issue help |
<cr> | Netrw will enter the directory or read the file |
<del> | Netrw will attempt to remove the file/directory |
- | Makes Netrw go up one directory |
a | Toggles between normal display, hiding (suppress display of files matching g:netrw_list_hide) showing (display only files which match g:netrw_list_hide) |
c | Make browsing directory the current directory |
C | Setting the editing window |
d | Make a directory |
const iterable = function* (obj) { | |
yield* Object.keys(obj).map(key => [key, obj[key]]); | |
}; |
const shuffle = (arr, mixed = [], pool = arr.slice()) => { | |
const remaining = pool.length; | |
if (!remaining) return mixed; | |
const index = Math.floor(Math.random() * remaining); | |
const el = pool.splice(index, 1).pop(); | |
mixed.push(el); | |
return shuffle(arr, mixed, pool); | |
}; |
This is a proposal for a lightning talk at the Reactive 2015 conference.
NOTE: If you like this, star ⭐ the Gist - the amount of stars decides whether it makes the cut!
React just got stateless components, meaning that they are in essence pure functions for rendering. Pure functions make it dead simple - even fun - to refactor your views
A lot of people mentioned other immutable JS libraries after reading my post. I thought it would be good to make a list of available ones.
There are two types of immutable libraries: simple helpers for copying JavaScript objects, and actual persistent data structure implementations. My post generally analyzed the tradeoffs between both kinds of libraries and everything applies to the below libraries in either category.
Libraries are sorted by github popularity.
function mapValues(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
result[key] = fn(obj[key], key); | |
return result; | |
}, {}); | |
} | |
function pick(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
if (fn(obj[key])) { |
Why would you want to do this? Because you often don't need more. It's nice to not have to think about your "router" as this big special thing.
Instead, with this approch, your app's current pathname
is just another piece of state, just like anything else.
This also means that when doing server-side rendering of a redux app, you can just do:
var app = require('your/redux/app')
var React = require('react')
const arr = [["foo", "bar"], ["hello", "world"]]; | |
// Create object from array of tuples | |
const obj = {}; arr.forEach(el => obj[el[0]] = el[1]); | |
const map = new Map(arr); | |
// Get object size | |
const objSize = Object.keys(obj).length; | |
const mapSize = map.size; |
- HTTP é a comunicação entre o servidor e o client.
- A web depende do TCP/IP, que é podemos falar que é uma suite de ferramentas.
- O HTTP usa o TCP para fazer a transferencia de dados e informação.
- O IP é responsável por conectar uma rede a outra
- O TCP é o mecanismo que permite transmitir essas informações.
- Imagine que tem o terminal A, que você quer mandar para B. O TCP quebra esse arquivo em vários fragmentos. O TCP vai organizar esses fragmentos no ponto B.
- IP conecta os pontos na rede, o TCP é a camada de dados.