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 { Router, Route, IndexRedirect, browserHistory } from 'react-router'; | |
import { syncHistoryWithStore } from 'react-router-redux'; | |
import { AppContainer } from './components/App'; | |
import { RandomContainer } from './components/Random'; | |
export default React.createClass({ | |
history: null, | |
_routes: null, |
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 knapsack(vals, wts, maxWeight) { | |
var maxValFound = 0; | |
function maxVal(vals, wts, currentVal, currentWeight) { | |
for(var i=0; i<vals.length; i++) { | |
var addVal = vals[i]; | |
var addWeight = wts[i]; | |
if(currentWeight + addWeight > maxWeight) { | |
continue; |
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
// before | |
export default React.createClass({ …. }); | |
// after | |
export default class extends React.Component { … } |
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
const processResponseBody = async (response) => { | |
let result = ''; | |
if (!response || !response.body) { | |
return; | |
} | |
const reader = response.body.getReader(); | |
return new Promise((resolve) => { | |
reader.read().then(function processText({ done, value }) { | |
// Result objects contain two properties: |
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
const renderConditionCards = () => { | |
const renderedConditions = isMobileBreakpoint | |
? conditions[0] | |
: conditions.slice(0, 4); | |
return renderedConditions.map((condition, i) => { | |
const percentageProbability = getPercentageText(condition.probability); | |
const isTopCondition = i === 0; | |
const isSecondCondition = i === 1; | |
const lastIteration = i === renderedConditions.length - 1; | |
const shouldRenderAccordion = |
OlderNewer