This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<title>WebKit contentEditable focus bug workaround</title> | |
<script type='text/javascript' src='http://code.jquery.com/jquery-1.6.2.js'></script> | |
<script type='text/javascript'> | |
//<![CDATA[ | |
$(function(){ |
This file contains 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
/** | |
* Sort array of objects based on another array | |
*/ | |
function mapOrder (array, order, key) { | |
array.sort( function (a, b) { | |
var A = a[key], B = b[key]; | |
This file contains 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
// <img id="myimage" src="http://placecage/1280/720"> | |
var image = document.getElementById('myimage'); | |
var mc = new Hammer.Manager(image); | |
var pinch = new Hammer.Pinch(); | |
var pan = new Hammer.Pan(); | |
pinch.recognizeWith(pan); |
This file contains 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 React from 'react'; | |
const IGNORE_CLASS = 'ignore-react-onclickoutside'; | |
export default function clickOutside(BaseComponent) { | |
return class ClickOutside extends React.Component { | |
static displayName = `${BaseComponent.name}ClickOutside`; |
This file contains 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
# place this snippet into init.coffee in ~/.atom directory | |
atom.workspace.observeTextEditors (editor) -> | |
if editor.getTitle() isnt "untitled" | |
sp = editor.getPath().split('/') | |
title = sp.slice(sp.length-2).join('/') | |
editor.getTitle = -> title | |
editor.getLongTitle = -> title | |
for item in atom.workspace.getPaneItems() |
This file contains 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 React from "react"; | |
import ReactDOM from "react-dom"; | |
import configureStore from "./store/configureStore"; | |
const store = configureStore(); | |
const rootEl = document.getElementById("root"); |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" | |
content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"> | |
<title>Pinch Zoom</title> | |
</head> | |
<body> |
This file contains 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 getEditorState = this.props.store.getItem('getEditorState'); | |
const setEditorState = this.props.store.getItem('setEditorState'); | |
const selection = this.props.store.getItem('lastSelection'); | |
const editorState = getEditorState(); | |
const updateSelection = new SelectionState({ | |
anchorKey: selection.anchorKey, | |
anchorOffset: selection.anchorOffset, | |
focusKey: selection.anchorKey, | |
focusOffset: selection.focusOffset, | |
isBackward: false, |