Weekly "You don't know JavaScritpt" chapter
- Session 1: Breaking the ice - 17/05/2017
- Session 2: Scope & Closures - 24/05/2017
- Chapters 2 & 3
- Session 2: Scope & Closures - 24/05/2017
- Chapter 4 (Hoisting)
| /// <reference path="./typings/globals/node/index.d.ts" /> | |
| namespace Sundio { | |
| /** | |
| * Vertex | |
| */ | |
| export class Vertex { | |
| private _color: number; | |
| private _links: Vertex []; |
| namespace Sundio { | |
| /** | |
| * Computes how many ways someone can use to climb a given number of stairs by | |
| * doing it in groups of two or one stair at time. | |
| * | |
| * @param stairs The number of stairs to climb. | |
| * @returns The number of ways someone can climb the stairs. | |
| */ | |
| export function howManyWays(stairs: number): number { | |
| // For known values, return the result directly. |
| namespace Sundio { | |
| /** | |
| * Node | |
| * | |
| * A simple implementation of a binary node. | |
| */ | |
| export class Node <T> { | |
| private _n: T; | |
| private _lSon: Node <T>; |
| @function valueToJSON($value, $key) { | |
| $is_first_value: true; | |
| $json_string: '{#{$key}:{'; | |
| @if (type-of($value) == 'map') { | |
| $json_string: $json_string + '{'; | |
| @each $_key, $_value in $value { | |
| @if not($is_first_value) { | |
| $json_string: $json_string + ','; |
| const fs = require('fs-extra') | |
| const path = require('path') | |
| const chalk = require('chalk') | |
| const scissors = require('scissors') | |
| const INPUT_FOLDER = './input/' | |
| const OUTPUT_FOLDER = './output/' | |
| fs.readdirSync(INPUT_FOLDER).forEach(fileName => { | |
| let pdf = scissors(path.join(INPUT_FOLDER, fileName)) |
| import { BaseTheme, Theme, ThemeManager } from 'styled-responsive-theming' | |
| import Button from './Button' | |
| const breakpoints = [ | |
| 480, | |
| 600, | |
| 840, | |
| 960, | |
| 1280, |
| const PrimaryDescriptionList = () => ( | |
| <DescriptionList | |
| flexDirection={['column', 'row']} | |
| > | |
| <DescriptionList.Item | |
| mr={[0, 4]} | |
| > | |
| <DescriptionList.Label>Label 1</DescriptionList.Label> | |
| <DescriptionList.Detail>Detail 1</DescriptionList.Detail> | |
| </DescriptionList.Item> |