Skip to content

Instantly share code, notes, and snippets.

View robertpenner's full-sized avatar

Robert Penner robertpenner

View GitHub Profile

Angular2 + JSPM cheat sheet

First time setup

  • install jspm beta: npm install -g jspm@beta
  • set up your project: jspm init
  • install dependencies: jspm install angular2 reflect-metadata zone.js es6-shim

This will create a jspm_packages folder, and a config.js file.

Open the config.js file - this file manages options for the System.js loader - tweak it as appropriate

@robertpenner
robertpenner / Letter to India Embassy in Nepal - Disruption of Medical Supplies.MD
Last active November 19, 2015 06:27
Letters regarding Madhes protests 2015. Feel free to copy/paste and send these under your own name.

To: [email protected] - Press Information Wing, India Embassy

To: [email protected] - Economic Cooperation Wing, India Embassy

To: [email protected] - Economic Wing, India Embassy

Namaste,

I am concerned about the disruption of essential medical supplies to Nepal's medical community. Can you tell me what India is doing to coordinate with the Nepal government to ensure that medicine and other equipment will reach the people whose lives depend on it?

@robertpenner
robertpenner / README.md
Created March 17, 2016 04:24 — forked from johnlindquist/README.md
Angular 2 Clock

Angular2 Starter Gist Run

@robertpenner
robertpenner / config.js
Last active March 17, 2016 04:29 — forked from johnlindquist/config.js
Angular 2 RxJS TypeWriter
System.config({
//use typescript for compilation
transpiler: 'typescript',
//typescript compiler options
typescriptOptions: {
emitDecoratorMetadata: true
},
//map tells the System loader where to look for things
map: {
app: "./src",
@robertpenner
robertpenner / config.js
Created March 17, 2016 04:32 — forked from johnlindquist/config.js
angular 2 with sagas and reducers
System.config({
//use typescript for compilation
transpiler: 'typescript',
//typescript compiler options
typescriptOptions: {
emitDecoratorMetadata: true
},
//map tells the System loader where to look for things
map: {
app: "./src",
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>RxJSCraft</title>
<script src="https://npmcdn.com/[email protected]/dist/system.js"></script>
<script src="https://npmcdn.com/[email protected]/lib/typescript.js"></script>
<script src="https://npmcdn.com/[email protected]/bundles/Rx.js"></script>
<style>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>RxJSCraft</title>
<script src="https://npmcdn.com/[email protected]/dist/system.js"></script>
<script src="https://npmcdn.com/[email protected]/lib/typescript.js"></script>
</head>
SystemJS.config({
transpiler: "typescript",
typescriptOptions: {
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
map: {
"rxjs": "https://npmcdn.com/rxjs",
"angular2": "https://npmcdn.com/angular2",
"@ngrx": "https://npmcdn.com/@ngrx",
@robertpenner
robertpenner / employee_salaries.ts
Last active June 26, 2020 23:16
Employee Average Salaries | Victor Savkin's Functional TypeScript
// https://vsavkin.com/functional-typescript-316f0e003dc6
class Employee {
constructor(public name: string, public salary: number) {}
}
class Department {
constructor(public employees: Employee[]) {}
works(employee: Employee): boolean {
[] + []; // JavaScript will give you "" (which makes little sense), TypeScript will error
//
// other things that are nonsensical in JavaScript
// - don't give a runtime error (making debugging hard)
// - but TypeScript will give a compile time error (making debugging unnecessary)
//
{} + []; // JS : 0, TS Error
[] + {}; // JS : "[object Object]", TS Error
{} + {}; // JS : NaN, TS Error