Skip to content

Instantly share code, notes, and snippets.

@goncalobo
goncalobo / index.test.js
Created February 26, 2019 13:59
Workaround to test a custom hook API (https://codesandbox.io/s/jvo251qqwy)
import React, { useState, useEffect } from "react";
import { act } from "react-dom/test-utils";
import ShallowRenderer from "react-test-renderer/shallow";
import Enzyme, { shallow } from "enzyme";
import Adapter from "enzyme-adapter-react-16";
Enzyme.configure({ adapter: new Adapter() });
// Custom Hook API being subject to testing
@geoffmiller
geoffmiller / mobx-recompose.jsx
Last active December 11, 2018 22:20
Mobx with Recompose structure
const { compose, mapProps, withHandlers, lifecycle } = Recompose;
const { observable, action } = mobx;
const { inject, observer, Provider } = mobxReact;
const { PropTypes } = React;
// store
// ============================
const counterStore = observable({
// for primitive values, wrap the value inside a observable,
// or wrap it in an plain js object
@zhaocnus
zhaocnus / git.sh
Last active January 24, 2018 07:56
# create local branch (shorthand)
git checkout -b <branch_name>
# create local branch
git branch <branch_name>
git checkout <branch_name>
# and then start hacking and commit
# push branch to remote

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@jfmengels
jfmengels / lodash-fp-documentation.md
Last active February 6, 2024 20:57
Generated docs for Lodash/fp. Help make them better at https://github.com/jfmengels/lodash-fp-docs
@Restuta
Restuta / howto-put-git-repo-into-another-repo.md
Last active April 22, 2021 16:43
How to make git repo to be another's repo subfolder preserving history

Hacky way (let me know if you know better one)

Let's say you have repo Main and repo Proto, you want to put your Proto under Main, so folder structure will be the following:

|-SRC
   |---proto

and you also want to preserve commit history, so everybody can see what you were doing while developing proto, sounds like pretty easy task. The easiest way is to create folder structure similar to Main repo SRC\proto and start working using is as a root, but if you like me, you didn't think about this beforehand, so you path would be harder: