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 { scaleOrdinal } from 'd3-scale'; | |
import { arc as d3Arc, pie as d3Pie } from 'd3-shape'; | |
import { csvParse } from 'd3-dsv'; | |
// Same as data.csv | |
import dataCsv from './data'; | |
import './chart.css'; |
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 { combineReducers, createStore, compose } from 'redux'; | |
import axios from 'axios'; | |
const nameReducer = (state = 'Anonymous', action) => { | |
switch (action.type) { | |
case 'CHANGE_NAME': | |
return action.name; | |
default: | |
return state; |
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 publicPath = 'public'; | |
// Node os module | |
// The os module provides a number of operating system-related utility methods. | |
// It can be accessed using: | |
const os = require('os'); | |
// Using a single monolithic configuration file impacts comprehension and | |
// removes any potential for reusability. | |
// As the needs of your project grow, you have to figure out the means to manage | |
// webpack configuration more effectively. |
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
// Given the array of prices, return a new array with the prices n % lower. | |
const discount = (originalPrices, discountAmount) => { | |
const multiplier = 1 - discountAmount; | |
// we must clone the array | |
let result = new Array(originalPrices); | |
for (let i = 0; i < originalPrices.length; i++) { | |
result[i] = originalPrices[i] * multiplier; | |
} | |
return result; | |
} |
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
// for loop | |
const sum = (array) => { | |
let result = 0; | |
for (let i = 0; i < array.length; i++) { | |
result += array[i]; | |
} | |
return result; | |
} | |
const numbers = [5, 25, 8, 18]; |
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 Chart { | |
constructor(opts) { | |
// load in arguments from config object | |
this.data = opts.data; | |
this.element = opts.element; | |
// create the chart | |
this.draw(); | |
} |
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 newReleases = [{ | |
"id": 70111470, | |
"title": "Die Hard", | |
"boxart": "http://cdn-0.nflximg.com/images/2891/DieHard.jpg", | |
"uri": "http://api.netflix.com/catalog/titles/movies/70111470", | |
"rating": 4.0, | |
"bookmark": [] | |
}, | |
{ | |
"id": 654356453, |
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
let footballPlayers = [{ | |
gender: "M", | |
name: "Karim Benzema", | |
age: 29, | |
club: "Real Madrid CF", | |
country: "Spain" | |
}, | |
{ | |
gender: "M", | |
name: "Samir Nasri", |
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 { PenguinModel } from './penguinModel'; | |
import { PenguinView } from './penguinView'; | |
interface IPenguinViewModel { | |
name: string; | |
imageUrl: string; | |
size: string; | |
favoriteFood: string; | |
previousIndex: number; | |
nextIndex: number; |
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
interface BurgerBoy { | |
size: number; | |
cheese: boolean; | |
pepperoni: boolean; | |
lettuce: boolean; | |
tomato: boolean; | |
addPepperoni(): any; | |
addCheese(): any; | |
addLettuce(): any; | |
addTomato(): any; |