Skip to content

Instantly share code, notes, and snippets.

@tomcask
tomcask / draftjs-initial-state.js
Created December 23, 2016 08:22
Example of initial state with image
const initialState = {
"entityMap": {
"0": {
"type": "image",
"mutability": "MUTABLE",
"data": {
"src": "https://www.google.es/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png"
}
}
},
@tomcask
tomcask / draftjs-create-blocks-with-Image.js
Created December 23, 2016 08:19
Create draftjs blocks with images
const createBlocksWithImage = ()=>{
const url = "https://www.google.es/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png";
const entityKey = Entity.create( 'image', 'IMMUTABLE', { src: url } );
const charData = CharacterMetadata.create({ entity: entityKey })
const blockSpec = {
type : 'atomic',
text : ' ',
key: genKey(),
depth: 0,
characterList: List(Repeat(charData, 1))
@tomcask
tomcask / destructuring.js
Created December 5, 2016 10:15 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@tomcask
tomcask / export-syntax.js
Created December 1, 2016 14:36 — forked from caridy/export-syntax.js
ES6 Module Syntax Table
// default exports
export default 42;
export default {};
export default [];
export default foo;
export default function () {}
export default class {}
export default function foo () {}
export default class foo {}
@tomcask
tomcask / react-terminology.md
Created November 22, 2016 08:55 — forked from sebmarkbage/react-terminology.md
React (Virtual) DOM Terminology
@tomcask
tomcask / Enhance.js
Created November 22, 2016 08:54 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@tomcask
tomcask / .gitconfig
Last active November 4, 2016 12:24 — forked from shawndumas/.gitconfig
Using WinMerge as the git Diff/Merge Tool on Windows 64bit
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
tool = winmerge
[mergetool "winmerge"]
name = WinMerge
@tomcask
tomcask / DropboxIgnore.md
Created November 3, 2016 23:09 — forked from idleberg/DropboxIgnore.md
Ignore node_modules/bower_components folders in your Dropbox

This script scans your Dropbox (or any given folder) for folders stored in the ignore array and excludes them from syncing. Makes use of the official Dropbox CLI

I'm a beginner at bash, so all improvements are welcome!

#!/bin/bash

set -e

# SETTINGS
@tomcask
tomcask / cheatsheet-array-methods.md
Last active November 3, 2016 10:21
cheatsheet Manipulate Array methods

##Diagram...

unshift → array ← push

shift ← array → pop

##Chart:

action add remove start end
@tomcask
tomcask / search linkedin persons
Last active October 27, 2016 08:17
Search all people working in a company with linkedin
company.com site:linkedin.com/in/