DO's:
- Use explicit contracts to pipe data & events between systems
- Business rules should bubble towards the top, UI and semantics should sink towards the bottom
DONT's:
function mergeElements(target, source) { | |
var seen = {}; | |
if (target.tagName != source.tagName) { | |
console.log("tagname change:", target.tagName, source.tagName, source) | |
target.parentNode.replaceChild(source, target); | |
return; | |
} | |
_.each(source.attributes, function(att) { | |
seen[att.nodeName] = true; | |
if (att.nodeName === 'data-reactid') { |
/** @jsx this */ | |
//classic callback | |
function clicker(props, children, render) { | |
var clicks = 0; | |
function clicked(event) { | |
event.preventDefault(); | |
clicks += 1; | |
render(); //or render(clicks) to allow caching | |
} | |
return function() { |
function siteDef(state) { | |
return <div> | |
function* () { | |
var state = "Your Site"; | |
var resolve; | |
function render() { | |
return <h1 contentEditable={true} onInput={onInput}>{state}</h1>; | |
} | |
function rerender() { |
Copyright (c) <year> <copyright holders> | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR T |
var IReact = require.bind(window.frames['layout'])('react'); | |
IReact.renderComponent(IReact.DOM.div({}, "hello world"), window.frames['layout'].document.body); |
from OpenSSL import crypto, SSL | |
from socket import gethostname | |
import socket | |
import os | |
import re | |
from pprint import pprint | |
from time import gmtime, mktime | |
from os.path import exists, join |
var _ = require('lodash'); | |
function isComponent(obj) { | |
//ghetto check because JS | |
return (obj && obj.setState) | |
} | |
function deepCloneComponent(tpl) { | |
if (!tpl) return; | |
if (_.isArray(tpl)) { |
A compilation of software development techniques using Steve Ballmer as a mentor. Feel free to fork & add.
(defn show-form [data _] | |
(om/component | |
(let [schema (:current-form data) | |
alpaca-html (.html (.alpaca (js/jQuery. "<div/>") (clj->js {:schema schema}))) | |
form-html (js/React.DOM.div (clj->js {:dangerouslySetInnerHTML {:__html alpaca-html}}))] | |
form-html))) |