Skip to content

Instantly share code, notes, and snippets.

View bryceosterhaus's full-sized avatar
🐕

Bryce Osterhaus bryceosterhaus

🐕
View GitHub Profile
@bryceosterhaus
bryceosterhaus / main.js
Created August 9, 2017 18:10
metal instantiation
import Component from 'metal-jsx';
import App from './App';
window.App = node => {
Component.render(<App />, node);
};
import Component, {Config} from './Component';
import getCN from 'classnames';
import {uniqueId} from 'lodash';
import Select from '../Select';
import Label from './Label';
import validate, {checkRequired} from '../../util/form-validators';
// converts to
@bryceosterhaus
bryceosterhaus / store.js
Created July 7, 2017 18:07
store structure
store:
{
division: {
1: {
data: {
classPK: 1
},
network:
pages: {
title: {
@bryceosterhaus
bryceosterhaus / file.md
Created June 23, 2017 00:14
Callbacks vs. Events

Say you have three nested components. GrandParent -> Parent -> Child. You have state(foo and bar) that lives in Grandparent. That state is then changed by something that happens in Child. There are two different ways to think about how to get this state to change, Event Emitting and Callback passing. I think it would be wise of us to consider switching to a callback approach rather than an Event Emitting. Primarily because I think it reduces unneccessary boilerplate and having to write logic in the "middle man" component, which in this case is the parent.

Here is the code for the two different approaches. Let me know what you think

Event Emitting

{namespace GrandParent}

/**

Not Authenticated

Route '/' should redirect to '/signin'

Authenticated

Route '/' should return html(or handlebars) file with your react app

Example html file

<div id="root"></div>
 // This script should attach your react app to the #root node
@bryceosterhaus
bryceosterhaus / README.txt
Last active May 1, 2017 21:45
devtools flow
document_start
-> initializer
-> installInitialHook (sets window.__METAL_DEV_TOOLS_HOOK__)
Open Inspector
-> devtools.js
if window.__METAL_DEV_TOOLS_HOOK__ && window.__METAL_DEV_TOOLS_HOOK__.hasRoots()
-> panel.js
-> background.js (initialize contentScript)
#lfrShutdownMessage {
position: fixed;
top: 100%;
left: 0;
right: 0;
z-index: 1;
}
RC.actions.showModal(
{
fullScreen: true,
hideOnBlur: false,
modalProps: {id: 30601},
modalType: 'ORG_CHART'
}
)
@bryceosterhaus
bryceosterhaus / table.md
Last active April 20, 2017 19:44
table
First Header Liferay.com Thrid Header Fourth Header Thrid Header
Content from cell 1 Image of Yaktocat Italics Content from cell 4 Strikethrough
Content in the first column Image of Yaktocat Bold Content from cell 2 Content from cell 2
public void viewLoopDivisionHierarchy() throws Exception {
if (!isRespondingTo("json")) {
return;
}
LoopDivision loopDivision = LoopDivisionUtil.fetchLoopDivision(request, themeDisplay);
_validateView(loopDivision);
JSONArray childLoopDivisionJSONArray = JSONFactoryUtil.createJSONArray();