This file contains hidden or 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 add(a, b) { | |
| return a + b; | |
| } | |
| let number = add(2, 2); |
This file contains hidden or 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 tokenExpired(token, currentDate) { | |
| return token.expirationDate < currentDate; | |
| } |
This file contains hidden or 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
| test('tokenExpired', () => { | |
| const token = { token: '123-abc-123', expirationDate: new Date('2018-01-01T12:00:00.000Z') }; | |
| const timeBeforeTokenExpiration = new Date('2018-01-01T11:59:00.000Z'); | |
| const timeAfterTokenExpiration = new Date('2018-01-01T12:01:00.000Z'); | |
| expect(tokenExpired(token, timeBeforeTokenExpiration)).toBe(false); | |
| expect(tokenExpired(token, timeAfterTokenExpiration)).toBe(true); | |
| }); |
This file contains hidden or 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
| router.post('/:id/title-image', (req, res, next) => { | |
| lwip.open(req.file.buffer, 'jpg', (err, image) => { | |
| if (err) { next(err); return; } | |
| let ratio = (image.width() > 960 ? (960 / image.width()) : 1); | |
| image.scale(ratio, (err, image) => { | |
| if (err) { next(err); return; } | |
| image.crop(image.width(), Math.min((image.width() / 2), image.height()), (err, image) => { | |
| if (err) { next(err); return; } | |
| image.toBuffer('jpg', { quality: 80 }, (err, buffer) => { |
This file contains hidden or 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
| <div *ngFor="let hero of heroes">{{hero.name}}</div> | |
| <input #heroInput> {{heroInput.value}} |
This file contains hidden or 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 add = (a, b) => a + b; | |
| const sum = array => array.reduce(add, 0); |
This file contains hidden or 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 EmployeesTable = ({ employees }) => ( | |
| <table> | |
| <tr><th>Name</th><th>Position</th></tr> | |
| {employees.map( | |
| ({ name, position }) => <tr><td>{name}</td><td>{position}</td></tr> | |
| )} | |
| </table> | |
| ); |
This file contains hidden or 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
| <Surface width={surfaceWidth} height={surfaceHeight} left={0} top={0}> | |
| <Image style={imageStyle} src='...' /> | |
| <Text style={textStyle}> | |
| Here is some text below an image. | |
| </Text> | |
| </Surface> |
This file contains hidden or 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
| { | |
| optimization: { | |
| splitChunks: { | |
| cacheGroups: { | |
| vendors: { | |
| test: /[\\/]node_modules[\\/]/, | |
| name: 'vendors', | |
| chunks: 'all', | |
| } | |
| } |
This file contains hidden or 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 * as React from 'react'; | |
| import { createRoute } from 'router-8000'; | |
| import { LandingViewContainer } from 'views/landing/container'; | |
| function getRouteComponent(): JSX.Element { | |
| return <LandingViewContainer />; | |
| } | |
| createRoute('/', getRouteComponent); |