Skip to content

Instantly share code, notes, and snippets.

return newStateWithSelection;
const newStateWithSelection = EditorState.forceSelection(stateAllowUndo, currentSelection);
const stateNoUndo = EditorState.set(state, { allowUndo: false });
const newState = EditorState.push(stateNoUndo, combinedContentState, 'insert-fragment');
const stateAllowUndo = EditorState.set(newState, { allowUndo: true });
const combinedBlockMap = newBlockMap.concat(currentBlockMap);
const combinedContentState = ContentState.createFromBlockArray(combinedBlockMap.toArray());
const { blocks } = action.payload;
const newContentState = convertFromRaw({ blocks, entityMap: {} });
const newBlockMap = newContentState.getBlockMap();
const currentContentState = state.getCurrentContent();
const currentBlockMap = currentContentState.getBlockMap();
const currentSelection = state.getSelection();
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();
//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.
#include <FastLED.h>
#define NUM_LEDS 10
#define LED_PIN 9
#define LED_TYPE WS2811
CRGB led[NUM_LEDS];
void setup()
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\] $ "