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
Snapshot of Khan Academy's BigBingo A/B testing framework and related code. | |
Here's a basic overview: | |
-summarize.py is the most interesting file. It contains all stages of the | |
summarize task, as well as the publish and archive steps that happen at the | |
end. | |
-bq_pipelines.py contains lots of useful pipelines for interacting with | |
BigQuery. QueryToTableBatchPipeline can run many simultaneous queries, and will | |
properly handle all batching and retry logic. | |
-config.py is where all experiment configuraiton lives. For this Gist, I |
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
export interface ActiveEnzymeProps { | |
color: string; | |
name: string; | |
} | |
function ActiveEnzyme({color, name}: ActiveEnzymeProps): JSX.Element { | |
return ( | |
<> | |
<td className="mono">{name}</td> | |
<td> | |
<div style={{backgroundColor: color}} className="swatch" /> |
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
function ActiveEnzyme({}: ActiveEnzymeProps): JSX.Element { | |
return ( | |
<> | |
<td className="mono">Acc65I</td> | |
<td> | |
<div style="background-color: #F58A5E;" className="swatch" /> | |
</td> | |
</> | |
); | |
} |
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 ActiveEnzymeJadeTemplate from 'toolbar/templates/activeenzyme.jade'; | |
import {makeJadeTransitionShim} from 'util/makeJadeTransitionShim'; | |
export interface ActiveEnzymeProps { | |
} | |
function ActiveEnzyme({}: ActiveEnzymeProps): JSX.Element { | |
return <span>TODO</span>; | |
} | |
export default makeJadeTransitionShim<ActiveEnzymeProps>(ActiveEnzymeJadeTemplate, ActiveEnzyme); |
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
type Template<T> = (args: T) => string; | |
export function makeJadeTransitionShim<T>(jadeTemplate: Template<T>, Component: React.ComponentType<T>): Template<T> { | |
return (args: T) => { | |
const jadeResult = jadeTemplate(args); | |
const reactResult = ReactDOMServer.renderToStaticMarkup(<Component {...args} />); | |
assert(jadeResult === reactResult, 'Results not equal!'); | |
return jadeResult; | |
}; | |
} |
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
function template(locals) { | |
var buf = []; | |
var jade_mixins = {}; | |
var jade_interp; | |
;var locals_for_with = (locals || {});(function (color, name) { | |
buf.push("<td class=\"mono\">" + (jade.escape(null == (jade_interp = name) ? "" : jade_interp)) + "</td><td>"); | |
if ( color) | |
{ | |
buf.push("<div" + (jade.attr("style", 'background-color:' + color, true, false)) + " class=\"swatch\"></div>"); | |
} |
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
export interface ActiveEnzymeProps { | |
color: string; | |
name: string; | |
onRemove: () => void; | |
} | |
export default function ActiveEnzyme({color, name, onRemove}: ActiveEnzymeProps): JSX.Element { | |
return ( | |
<tr onClick={onRemove}> | |
<td className="mono">{name}</td> | |
<td> |
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 ActiveEnzymeTemplate from './templates/activeenzyme.jade'; | |
... | |
class ActiveEnzymeItemView extends Backbone.View { | |
static initClass() { | |
this.prototype.tagName = 'tr'; | |
this.prototype.events = { | |
click: 'removeEnzyme', | |
}; | |
} | |
removeEnzyme() { |
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
td.mono= name | |
td | |
div.swatch(style='background-color: ' + color + ';') |
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
span | |
span.ownable-owner= owner_handle | |
if !writable | |
span.glyphicon.glyphicon-eye-open | |
| | |
= name |
NewerOlder