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 squareSum(numbers){ | |
var total = 0; | |
for(var i = 0; i < numbers.length; i++) { | |
total += numbers[i] * numbers[i]; | |
} | |
return total; |
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
class Button extends React.Component { | |
handleClick = () => { | |
this.props.onClickFunction(this.props.incrementValue); | |
}; | |
render() { | |
return ( | |
<button onClick={this.handleClick}> | |
+{this.props.incrementValue} | |
</button> |
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 Card = (props) => { | |
return ( | |
<div style={{margin: '1em'}}> | |
<img width="75" src={props.avatar_url} /> | |
<div style={{display: 'inline-block', marginLeft: 10}}> | |
<div style={{fontSize: '1.25em', fontWeight: 'bold'}}>{props.name}</div> | |
<div>{props.company}</div> | |
</div> | |
</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
const Stars = (props) => { | |
// const numberofStars = 1 + Math.floor(Math.random()*9); | |
return ( | |
<div className="col-5"> | |
{_.range(props.numberofStars).map(i => | |
<i key={i} className="fa fa-star"></i> | |
)} | |
</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
// bit.ly/s-pcs | |
var possibleCombinationSum = function(arr, n) { | |
if (arr.indexOf(n) >= 0) { return true; } | |
if (arr[0] > n) { return false; } | |
if (arr[arr.length - 1] > n) { | |
arr.pop(); | |
return possibleCombinationSum(arr, n); | |
} | |
var listSize = arr.length, combinationsCount = (1 << listSize); | |
for (var i = 1; i < combinationsCount ; 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
?ps_debug=true | |
// Add to URL and reload page - shows all analytics events being captured by the Data Layer in the console. | |
&ps_debug=true | |
// same query string except that it is not be used first. | |
analytics.debug(); | |
analytics.debug(false); |
OlderNewer