Skip to content

Instantly share code, notes, and snippets.

@statico
statico / pitchpatterns.md
Last active November 10, 2021 21:36
Pitch Paterns
@aweary
aweary / App.js
Last active August 29, 2021 14:06
import React from "react";
import useMutableReducer from "./useMutableReducer";
const reducer = (draft, action, state) => {
switch (action) {
case "increment":
draft.count++;
break;
case "decrement":
draft.count--;
@WickyNilliams
WickyNilliams / README.md
Last active September 24, 2020 11:01
So you want to publish a react component?!

So you want to publish a react component?!

This is a quick guide of what you need to do to publish a react component for use by others. This guide is distilled from a conversation [0] on twitter. I will reference individual tweets, where appropriate (thereby shifting blame for incorrect advice from me to the authors :D)

Assumptions

  1. You are using some sort of module system in your source
  2. You have a build step
  3. You want broad support for your component (browser-ready, npm compatible, consumable by bower)
@markerikson
markerikson / dispatching-action-creators.js
Last active May 2, 2020 14:27
Dispatching action creators comparison
// approach 1: define action object in the component
this.props.dispatch({
type : "EDIT_ITEM_ATTRIBUTES",
payload : {
item : {itemID, itemType},
newAttributes : newValue,
}
});
// approach 2: use an action creator function
@patio11
patio11 / bitfinex-03152019.md
Created April 26, 2019 00:29
`shasum bitfinex-03152019.md` is 938d939059a23aa84ce493db0c4d542748f849a7

Prediction as of 3/15/2019 JST:

  • Bitfinex is insolvent, for the Bitcoin economy's usual quixotic definition of insolvent.
  • This happened as a result of collateralizing Tether with BTC and other cryptocurrencies during the run-up.
  • Bitfinex / Tether treat whether Bitfinex held the collateral or Tether held the collateral as a material distinction, but that's ridiculous due to common control. The important fact: in 2018, ground truth diverged from "There is $1 in a bank account for every tether outstanding" to "There is $1 in a bank account and/or $1 worth of Bitcoin at prevailing prices available to Bitfinex for every tether outstanding."
  • This makes Tether synthetically long Bitcoin, via a receivable from Bitfinex. Bitfinex took the newly issued Tether and then, since this accounting shellgame appears to balance its books and leave it with surplus Bitcoin, either sold or lent the Bitcoin to short sellers during the run-up.
  • If Bitfinex simply sold the Bitcoin, they're doing relatively well for themselve
@Dr-Nikson
Dr-Nikson / 0-redux-auth.MD
Last active October 23, 2017 17:16
This is a redux-auth concept

This gist is about token-based authentication (who you are?) with redux

Currently it for clent-side apps only. Not for universall (isomorphic) apps. Will add it soon

0. Requirements

I'm using the promise middleware to dispatch actions like this: