Skip to content

Instantly share code, notes, and snippets.

View t-palmer's full-sized avatar

Todd Palmer t-palmer

  • Fujitsu
View GitHub Profile
@t-palmer
t-palmer / app.component.ts
Created February 27, 2018 03:46
Displaying environment JSON in a component
import { Component } from '@angular/core';
import { environment } from '../environments/environment';
@Component({
selector: 'app-root',
template: `
<h1>
ng-configuration
</h1>
{{config | json}}
@t-palmer
t-palmer / web.config
Created March 27, 2018 21:09
Example IIS web.config file for Angular Router applications
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Angular Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
@t-palmer
t-palmer / toh-index.html
Last active March 28, 2018 14:29
Tour of Heroes index.html updated to support deployment anywhere.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Tour of Heroes</title>
<base href="/" id="baseHref">
<script>
(function() {
var mypath = window.location.pathname;
@t-palmer
t-palmer / this-tester.js
Last active March 29, 2018 12:33
An example of lexical this in arrow functions.
class ThisTester {
constructor () {
this.testValue = 'ThisTester Class';
}
// in arrow functions we can freely use "this".
thisArrowTest() {
// define a local function like we might use in a promise or callback
let myFunction = (x) => console.log('arrow "this" works:', this.testValue)
@t-palmer
t-palmer / polyfills.ts
Last active August 26, 2019 18:43
polyfills file for so Angular can support Internet Explorer
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
@t-palmer
t-palmer / lite-index.html
Created April 14, 2018 00:09
Simple index.html example for lite-server article
<!DOCTYPE html>
<html>
<head>
<title>lite-server</title>
</head>
<body>
<a href="https://github.com/johnpapa/lite-server">lite-server</a> is awesome!
</body>
</html>
@t-palmer
t-palmer / lite-package.json
Last active April 14, 2018 13:45
Example package.json file for lite-server
{
"name": "lite",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "lite-server"
},
"keywords": [],
"author": "",
@t-palmer
t-palmer / lite-bs-config.json
Last active April 19, 2018 00:32
Sample lite-server config file
{
"port": 3000,
"server": {
"baseDir": "."
},
"browser": ["chrome"]
}
"projects": {
"example-ng6-lib-app": {
},
"example-ng6-lib-app-e2e": {
},
"example-ng6-lib": {
"root": "projects/example-ng6-lib",
"sourceRoot": "projects/example-ng6-lib/src",
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { ExampleNg6LibModule } from 'example-ng6-lib';
@NgModule({
declarations: [
AppComponent
],