This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createStore } from 'redux'; | |
| import combineReducers from './combineReducers'; | |
| let Store = createStore(combineReducers({ | |
| reducerA(state = 0, action, waitFor){ | |
| if ( action.type === 'TEST'){ | |
| waitState = waitFor(waitFor.reducerB) | |
| if ( waitState.reducerB === 5 ) | |
| state = 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setInterval(function() { | |
| Array.prototype.slice.call(document.querySelectorAll('[data-reactid]')) | |
| .forEach(function(element) { | |
| element.style.background = 'rgba(255,0,0,0.1)'; | |
| }) | |
| }, 500) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: MPL-2.0 | |
| // AES Encryption/Decryption with AES-256-GCM using random Initialization Vector + Salt | |
| // ---------------------------------------------------------------------------------------- | |
| // the encrypted datablock is base64 encoded for easy data exchange. | |
| // if you have the option to store data binary save consider to remove the encoding to reduce storage size | |
| // ---------------------------------------------------------------------------------------- | |
| // format of encrypted data - used by this example. not an official format | |
| // | |
| // +--------------------+-----------------------+----------------+----------------+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ------------ | |
| // counterStore.js | |
| // ------------ | |
| import { | |
| INCREMENT_COUNTER, | |
| DECREMENT_COUNTER | |
| } from '../constants/ActionTypes'; | |
| const initialState = { counter: 0 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Stop all containers | |
| containers=`docker ps -a -q` | |
| if [ -n "$containers" ] ; then | |
| docker stop $containers | |
| fi | |
| # Delete all containers | |
| containers=`docker ps -a -q` | |
| if [ -n "$containers" ]; then | |
| docker rm -f -v $containers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| erase_sim: | |
| ./reset_sim.sh 2>/dev/null; true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| var babel = require('babel-core'); | |
| var fs = require('fs'); | |
| // borrowed from https://github.com/babel/babel-jest/blob/master/index.js | |
| require.extensions['.jsx'] = function (module, filename) { | |
| var src = fs.readFileSync(filename, 'utf8'); | |
| // Allow the stage to be configured by an environment | |
| // variable, but use Babel's default stage (2) if |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component } from "React"; | |
| export var Enhance = ComposedComponent => class extends Component { | |
| constructor() { | |
| this.state = { data: null }; | |
| } | |
| componentDidMount() { | |
| this.setState({ data: 'Hello' }); | |
| } | |
| render() { |
While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.
Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.