remove ballmer example
chico committed
Feb 20, 2015 at 04:13 UTC
1876bc2432286b0378ee48449ca5bf9145e6691f
1 file changed
-42
examples/ballmer-peak/example.js
deleted
-42
@@ -1,42 +0,0 @@
1
-'use strict';
2
-
3
-function computeBallmerPeak(x) {
4
- // see: http://ask.metafilter.com/76859/Make-a-function-of-this-graph-Thats-like-an-antigraph
5
- x = x * 100;
6
- return (
7
- 1 - 1 / (1 + Math.exp(-(x - 6))) *.5 + Math.exp(-Math.pow(Math.abs(x - 10), 2) * 10)
8
- ) / 1.6;
9
-}
10
-
11
-function percentage(x) {
12
- return isNaN(x) ? 'N/A' : (100 - Math.round(x * 100)) + '%';
13
-}
14
-
15
-var BallmerPeakCalculator = React.createClass({
16
- getInitialState: function() {
17
- return {bac: 0};
18
- },
19
- handleChange: function(event) {
20
- this.setState({bac: event.target.value});
21
- },
22
- render: function() {
23
- var pct = percentage(computeBallmerPeak(this.state.bac));
24
- return (
25
- <div>
26
- <img src="./ballmer_peak.png" />
27
- <p>Credit due to <a href="http://xkcd.com/323/">xkcd</a>.</p>
28
- <h4>Compute your Ballmer Peak:</h4>
29
- <p>
30
- If your BAC is{' '}
31
- <input type="text" onChange={this.handleChange} value={this.state.bac} />
32
- {', '}then <b>{pct}</b> of your lines of code will be bug free.
33
- </p>
34
- </div>
35
- );
36
- }
37
-});
38
-
39
-React.render(
40
- <BallmerPeakCalculator />,
41
- document.getElementById('container')
42
-);