Skip to content

Instantly share code, notes, and snippets.

Working from home

Jonathan Creamer jcreamer898

Working from home
View GitHub Profile

Type 'from' in the editor and...


What even is TypeScript?

JavaScript + Types = Typescript

TypeScript as a compilter

npm i -g typescript


set -e
while [[ $# -gt 0 ]]
case $key in
View price.tsx
import * as React from "react";
import formatPrice from "../utils/formatPrice";
export interface IPriceProps {
num: number;
symbol: "$" | "€" | "£";
const Price: React.SFC<IPriceProps> = ({
View formatPriceJsDoc.ts
// @ts-check
* Format a price
* @param num {number} The price
* @param symbol {string} The currency symbol
const formatPrice = (num, symbol = "$") =>
View formatPrice.ts
const formatPrice = (num: number, symbol = "$": string) =>
`${symbol}${num.toFixed(2)}`; formatPrice("1234");
// num.toFixed is not a function
jcreamer898 / formatPrice.js
Last active Feb 2, 2018
Stuff for my typescript blog
View formatPrice.js
const formatPrice = (num, symbol = "$") =>
`${symbol}${num.toFixed(2)}`; formatPrice("1234");
jcreamer898 / launch.json
Last active Sep 20, 2017
How I use vscode's debugger with our nodejs apps
View launch.json
"version": "0.2.0",
"configurations": [
"type": "node",
"request": "launch",
"name": "Run tests",
"program": "${workspaceRoot}/node_modules/.bin/jest"
Name of thing Sorta like... Mounted? Can you even setState? What would you say... ya do here?
constructor initialize() nope nope init stuff NO side effects
componentWillMount beforeDomReady() nope yeah but don't Only needed in createClass now use constructor for most things
render render nope please no render stuff and don't set any state please
componentDidMount domReady() yup yup DOM is a go init jQuery plugins dispatch stuff
componentWillReceiveProps onChange() yup yup