Skip to content

Instantly share code, notes, and snippets.

View rafaelrinaldi's full-sized avatar

Rafael Rinaldi rafaelrinaldi

View GitHub Profile
@luiz
luiz / menu-example.html
Last active February 1, 2016 23:04
Example of menu tag usage
<article>
<h1>Using the correct tags in HTML</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In et iaculis
risus. Quisque quis magna diam. Suspendisse aliquet urna eu erat pretium, et
scelerisque odio pulvinar. Nullam fermentum diam nibh, vel eleifend ipsum
tempus ut. Nunc accumsan ligula eget tellus vestibulum, sit amet euismod quam
molestie. Integer feugiat urna sed enim hendrerit vestibulum. Suspendisse
ullamcorper, nisi non mollis eleifend, est nunc sagittis augue, nec convallis
eros est ultrices sem. Curabitur pretium condimentum nulla. Sed convallis augue
vitae metus interdum commodo nec in nulla. Vivamus vulputate eleifend semper.
@bendc
bendc / iterable.js
Created January 26, 2016 09:09
Make objects iterable
const iterable = function* (obj) {
yield* Object.keys(obj).map(key => [key, obj[key]]);
};
@t-mart
t-mart / netrw quick reference.md
Last active March 25, 2024 07:47
A quick reference for Vim's built-in netrw file selector.
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
@bendc
bendc / shuffle.js
Created December 21, 2015 11:13
Randomize arrays
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);
};
@ohanhi
ohanhi / joy-of-composition.md
Last active February 3, 2021 18:14
The Joy of Composition - Why stateless rendering is pure bliss

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!

The Joy of Composition

Why stateless rendering is pure bliss

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

@jlongster
jlongster / immutable-libraries.md
Last active September 11, 2021 08:32
List of immutable libraries

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.

Persistent Data Structures w/structural sharing

@gaearon
gaearon / slim-redux.js
Last active March 25, 2024 19:12
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
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])) {
@HenrikJoreteg
HenrikJoreteg / README.md
Last active September 20, 2021 01:36
Minimalist routing in Redux

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')
@bendc
bendc / hashmaps.js
Created August 7, 2015 19:30
Objects and maps compared
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;
@diegoeis
diegoeis / rinaldi-http2.md
Created June 18, 2015 18:27
Anotações da palestra do Rafael Rinaldi no #17elw em 2015

Rafael Rinaldi

HTTP/2

  • 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.