Skip to content

Instantly share code, notes, and snippets.

View context.js
import React from 'react'
const Context = React.createContext({})
const withContext = Component => props => {
const [state, setState] = React.useState()
return (
<Context.Provider value={[state, setState]}>
<Component {...props} />
View setup-jest-redux.js
import React from 'react'
import { render } from '@testing-library/react'
import { createStore } from 'redux'
import { Provider } from 'react-redux'
import reducers from 'your-reducers'
function renderWithRedux(
ui,
{ initialState, store = createStore(reducers, initialState) } = {}
) {
View setup-jest.js
import React, { useState } from 'react'
import Sidebar from './Sidebar'
import Edit from './Edit'
import { render, waitForElement, fireEvent } from '@testing-library/react';
describe('Component sidebar tests', () => {
const setup = () => {
View vscode-config.json
{
"eslint.workingDirectories": [
"live-plugins"
],
"javascript.validate.enable": false,
"eslint.options": {
"extensions": [
".tsx",
".ts",
".js"
@Wellers0n
Wellers0n / cloudSettings
Last active Feb 18, 2020
settings vscode intelie - Liverig
View cloudSettings
{"lastUpload":"2020-02-18T11:45:14.965Z","extensionVersion":"v3.4.3"}
View config-flow.json
{
"prettier.eslintIntegration": true,
"prettier.printWidth": 120,
"javascript.validate.enable": false,
"java.home": "/usr/lib/jvm/java-8-openjdk-amd64",
"workbench.colorTheme": "Forest Focus",
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
@Wellers0n
Wellers0n / ChangePassword.txt
Last active Sep 9, 2019
Change password mysql
View ChangePassword.txt
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';FLUSH PRIVILEGES;
@Wellers0n
Wellers0n / metro.config.js
Created Jun 30, 2019
metro config to monorepo
View metro.config.js
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
const path = require('path');
const getWorkspaces = require('get-yarn-workspaces');
const workspaces = getWorkspaces(__dirname);
View adb.txt
#!/usr/bin/env bash
# packager
adb reverse tcp:8081 tcp:8081
adb -d reverse tcp:8081 tcp:8081
View rootimport.js
import React from 'react';
import {createAppContainer, createStackNavigator} from 'react-navigation';
import FunctionScreen, {navigationOptions} from './src/screen/Function'
import ClassScreen from './src/screen/Class'
const Root = createStackNavigator({
ClassScreen: {
screen: ClassScreen
},