Skip to content

Instantly share code, notes, and snippets.

// handy method to create a Higher Order Component out of a
// Render Prop Component (like a Context.Consumer).
// handles, statics, displayName, refs, and value forwarding
function createHOCFromRenderProp({prop, Consumer}) {
return Component => {
function Wrapper(props, ref) {
return (
<Consumer>
{value => <Component {...{...props, [prop]: value, ref}} />}
@getify
getify / 1.md
Last active October 15, 2020 01:44
BetterPromise: a strawman experiment in subclassing Promise and "fixing" a bunch of its awkward/bad parts

Some things that are "better" with this BetterPromise implementation:

  • BetterPromise # then(..) accepts a BetterPromise (or Promise) instance passed directly, instead of requiring a function to return it, so that the promise is linked into the chain.

    var p = BetterPromise.resolve(42);
    
    var q = Promise.resolve(10);
    
    p.then(console.log).then(q).then(console.log);

Phoenix 1.4.x to 1.5.0 upgrade instructions

Phoenix 1.5 requires Elixir >= 1.7. Be sure your existing version is up to date by running elixir -v on the command line.

Install the new phx.new project generator

$ mix archive.uninstall phx_new
$ mix archive.install hex phx_new 1.5.0

:peepo-love: Emj Cheat Sheet (Slack → Github)

Esse é um cheat sheet com alguns emojis da Finbits para utilizar em PRs, issues e comentários: use com moderação :thumbsup-parrot:

:term: Bash

Alternativamente, você pode colocar a função abaixo no seu .zshrc para facilitar a busca e/ou copiar o <img> direto:

function emj() {
  raw="${1//:/}"
  companyid="T02BNKN7B1B" # substituir pelo id da empresa/grupo do slack
  emoji="${raw:-rainbowdance}" # substituir rainbowdance por um emoji default