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
| return newStateWithSelection; |
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
| const newStateWithSelection = EditorState.forceSelection(stateAllowUndo, currentSelection); |
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
| const stateNoUndo = EditorState.set(state, { allowUndo: false }); | |
| const newState = EditorState.push(stateNoUndo, combinedContentState, 'insert-fragment'); | |
| const stateAllowUndo = EditorState.set(newState, { allowUndo: 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
| const combinedBlockMap = newBlockMap.concat(currentBlockMap); | |
| const combinedContentState = ContentState.createFromBlockArray(combinedBlockMap.toArray()); |
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
| const { blocks } = action.payload; | |
| const newContentState = convertFromRaw({ blocks, entityMap: {} }); | |
| const newBlockMap = newContentState.getBlockMap(); |
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
| const currentContentState = state.getCurrentContent(); | |
| const currentBlockMap = currentContentState.getBlockMap(); | |
| const currentSelection = state.getSelection(); |
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 { EditorState, ContentState, convertFromRaw } from 'draft-js'; | |
| const editorStateReducer = (state = defaultEditorState, action) => { | |
| switch(action.type) { | |
| case MORE_CONTENT_RETRIEVED: { | |
| // Capture current state | |
| const currentContentState = state.getCurrentContent(); | |
| const currentBlockMap = currentContentState.getBlockMap(); | |
| const currentSelection = state.getSelection(); |
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
| //Program by Michael Bartlett | |
| //Libraries | |
| #include <Adafruit_NeoPixel.h> //Library to simplify interacting with the LED strand | |
| #ifdef __AVR__ | |
| #include <avr/power.h> //Includes the library for power reduction registers if your chip supports them. | |
| #endif //More info: http://www.nongnu.org/avr-libc/user-manual/group__avr__power.htlm | |
| //Constants (change these as necessary) | |
| #define LED_PIN A5 //Pin for the pixel strand. Does not have to be analog. |
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
| #include <FastLED.h> | |
| #define NUM_LEDS 10 | |
| #define LED_PIN 9 | |
| #define LED_TYPE WS2811 | |
| CRGB led[NUM_LEDS]; | |
| void setup() |
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
| parse_git_branch() { | |
| git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
| } | |
| export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ " |
NewerOlder