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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style type="text/css"> | |
body { | |
margin: 0; | |
padding: 0; | |
} | |
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
/** | |
* Sinon. | |
*/ | |
const CATS = ['Sassy', 'Tom']; | |
function sayMeow(cats) {} | |
describe('when sayMeow is called', () => { | |
beforeEach(() => { |
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 Repo { | |
name: string; | |
descriptio: string; | |
} |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 { Repo } from './Repo'; | |
export interface Repos { | |
isLoading: boolean; | |
repos: Repo[]; | |
hasError: boolean; | |
} |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Optimistic State Management</title> | |
</head> | |
<body> | |
<p>Number of items: <span id="number-of-items"></span></p> | |
<p>Total Cost: <span id="total-cost"></span></p> |
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 { Price } from './Price'; | |
export interface Product { | |
name: string; | |
description: string; | |
longDescription: string; | |
imageOne: string; | |
imageTwo: string; | |
imageThree: string; | |
price: Price; |
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 Price { | |
value: number; | |
currency: string; | |
vat: number; | |
stringRepresentation: string; | |
} |
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 { Product } from './Product'; | |
import { Price } from './Price'; | |
export const filterProductsByName = | |
(name: string) => | |
(products: Product[]) => | |
products.filter((product: Product) => product.name.includes(name)); | |
export const addPriceToProduct = | |
(price: Price) => |
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 { Product } from './Product'; | |
import { Price } from './Price'; | |
import { filterProductsByName, addPriceToProduct } from './product-utils'; | |
describe('product-utils', () => { | |
test('filterProductsByName', () => { | |
const name = 'Puffy'; | |
const puffy: Product = { | |
name: 'Puffy', |
OlderNewer