Skip to content

Instantly share code, notes, and snippets.

View oleersoy's full-sized avatar

Ole Ersoy oleersoy

  • Firefly Semantics Corporation
  • Chicago
View GitHub Profile
@oleersoy
oleersoy / partial1.ts
Created August 7, 2018 19:59
Partial Article
interface Product {
name: string;
description: string;
}
let currentProduct: Product = {
name: "FS2000",
description: "Hippie Control"
};
function update1(product: Product) {
Object.assign(currentProduct, product);
@oleersoy
oleersoy / rest1.ts
Created August 14, 2018 02:01
Example of completing a Todo with
interface Todo {
id:string;
title:string;
complete?:boolean;
}
let completed: boolean = true;
let todo:Todo = {title: "Do the Dew", id:"1"};
import { expect } from "chai";
import "mocha";
import {push} from './index';
describe("Push", () => {
it("should have four elements post push", () => {
const original = ['a', 'b'];
const result = ['a', 'b', 'c', 'd'];
expect(push(original, 'c', 'd')).to.eql(result);;
});
/**
* Pushes the elements onto the end of the array.
*
* @param original The original array
* @param elementN The arguments to be inserted
* @return The result array
*
@example
<pre>
const original = ['a', 'b'];
private supportsSvg;
private hasHtml5FileApiSupport;
constructor(@Optional() @Inject(DOCUMENT) document: Document) {
this.hasHtml5FileApiSupport = w.File && w.FileReader && w.FileList && w.Blob;
this.supportsSvg = !!(
document &&
document.createElementNS &&
document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect);
}
import { NgModule } from '@angular/core';
import {
MatButtonModule,
MatIconModule,
MatToolbarModule
} from '@angular/material';
const modules = [
MatButtonModule,
import { Component, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'my-toolbar',
template: `
<mat-toolbar color="primary">
<button mat-icon-button (click)="menu.emit()">
<mat-icon>menu</mat-icon>
</button>
<ng-content></ng-content>
/* Add application styles & imports to this file! */
/* You can add global styles to this file, and also import other style files */
@import "~@angular/material/prebuilt-themes/deeppurple-amber.css";
* {
box-sizing: border-box;
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Your Toolbar</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
import { Component, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'my-toolbar',
template: `
<mat-toolbar color="primary">
<button mat-icon-button (click)="menu.emit()">
<mat-icon>menu</mat-icon>
</button>
<ng-content></ng-content>