Skip to content

Instantly share code, notes, and snippets.

View iannbing's full-sized avatar

Huang-Ming Chang iannbing

View GitHub Profile
@iannbing
iannbing / .env
Created May 24, 2024 09:33
Setup local database with Docker
SA_PASSWORD=YourStrong!Passw0rd
@iannbing
iannbing / App.js
Created July 19, 2019 14:58
A minimal implementation of react-redux using Context API
import { Provider } from './store';
import reducer from './reducer';
const initialState = { firstName: 'Jon', lastName: 'Snow', email: 'jon.snow@email.com' }
const App = () => (<Dashboard>
<Provider reducer={reducer} initialState={initialState} >
<Header>
<UserProfile />
</Header>
@iannbing
iannbing / ComponentWithConsumer.test.js
Last active December 26, 2022 14:34
How to mock Consumer in Jest
import React from "react";
import { render } from "@testing-library/react";
beforeEach(() => {
jest.resetModules();
});
const getComponentWithConsumer = (context = {}) => {
jest.doMock("../../Context", () => {
return { Consumer: props => props.children(context) };
@iannbing
iannbing / ssh config
Created April 22, 2019 19:44
ssh config for multiple accounts
# path: ~/.ssh/config
# Work account, - the default config
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
# Personal account
Host github.com-personal
HostName github.com
@iannbing
iannbing / config.yml
Last active April 19, 2019 14:00
Minimal CircleCI config example
version: 2.1
commands:
install:
description: 'Install packages'
steps:
- checkout
- run:
name: 'Update NPM'
command: 'sudo npm install -g npm@latest'
<script src="http://static.jsbin.com/js/vendor/traceur.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
@iannbing
iannbing / ._reactFormatting
Last active November 15, 2022 17:04
A gist for initial eslint and prettier setup for React projects
We couldn’t find that file to show.