Skip to content

Instantly share code, notes, and snippets.

View bryceosterhaus's full-sized avatar
🐕

Bryce Osterhaus bryceosterhaus

🐕
View GitHub Profile
import getClassNames from 'classnames';
import React, {Component} from 'react';
import some from 'lodash/some';
import {connect} from 'react-redux';
import {EditorState, convertToRaw} from 'draft-js';
import uniqWith from 'lodash/uniqWith';
import CreatorImagePreview from './CreatorImagePreview';
import Icon from '../Icon';
@bryceosterhaus
bryceosterhaus / asset_entry_feed.jsp
Last active October 27, 2016 10:01
creator+feed
<%--
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
@bryceosterhaus
bryceosterhaus / ownline.js
Created April 15, 2016 21:08
Args should each be on their own line
export default DragDropContext(HTML5Backend)( //Args should each be on their own line (args on start line): DragDropContext(...)
DropTarget(NativeTypes.FILE, specObj, collectFunc)( //Args should each be on their own line (args on start line): DropTarget(...)
connect(
state => ({dirtyState: state.get('dirtyState')}),
{
addDirtyState,
removeDirtyState
}
)(PostBase)
)
/**
* @fileoverview Rule to flag use of variables before they are defined
* @author Ilya Volodin
*/
"use strict";
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
{
"_args": [
[
"eslint@^2.8.0",
"/usr/local/lib/node_modules/check-source-formatting"
]
],
"_from": "eslint@>=2.8.0 <3.0.0",
"_id": "[email protected]",
"_inCache": true,
ImageViewer.STATE = {
backgroundBlur: {
validator: Types.bool,
value: true
},
items: {
validator: Types.array
value: []
},
_currentIndex: {

Metal + Draft.js (4 months)

  • Pros
    • No need to write a new editor
  • Cons
    • React is still a dependency
    • Integration between metal and React
    • Unknown issues of VDOM inside of incremental-dom

Metal (6 months)

  • Pros
getDiv() {
return (
<div>
{"hi im a div"}
</div>
);
}
return (
{true &&
class Foo extends Component {
render() {
return (
<div>
{this.size}{this.config.foo}
</div>
)
}
}
packages/sort-lines/lib/sort-lines.coffee
sortLinesNatural = (editor) ->
sortTextLines editor, (textLines) ->
naturalSortRegex = /^(\d*)(\D*)(\d*)([\s\S]*)$/
textLines.sort (a, b) =>
a = a.toLowerCase()
b = b.toLowerCase()
return 0 if a is b
[__, aLeadingNum, aWord, aTrailingNum, aRemainder] = naturalSortRegex.exec(a)