Skip to content

Instantly share code, notes, and snippets.

View jdrzj's full-sized avatar
🐕

Jędrzej (NJ) Urbanski jdrzj

🐕
View GitHub Profile
@yosukehasumi
yosukehasumi / readme.md
Last active October 22, 2021 15:12
DigitalOcean Rails/Ubuntu/NGINX (16.04) Setup

DigitalOcean Rails/Ubuntu/NGINX (16.04) Setup

  1. Setup
  2. Swapfile
  3. NGINX
  4. ElasticSearch
  5. RVM
  6. Rails
  7. Postgres
  8. Capistrano
@prenaudin
prenaudin / insertCheckbox.js
Last active September 5, 2022 17:36
Add checkboxes to your Draft.js editor - insertCheckbox.js
import { Modifier, EditorState, Entity } from 'draft-js';
export default function insertCheckbox(editorState) {
// Define the checkbox entity
const entityKey = Entity.create('CHECKBOX', 'IMMUTABLE', { checked: false });
// Collapse selection
const selectionState = editorState.getSelection().merge({
anchorOffset: selectionState.getFocusOffset(),
});