Skip to content

Instantly share code, notes, and snippets.

Mike Hartington mhartington

Block or report user

Report or block mhartington

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ng-update-data.txt
Pure NG7 to NG8
$ ng update --force --verbose @angular/core @angular/cli
Locating potential npmrc files:
Trying '/Users/mhartington/n/etc/npmrc'...not found.
Trying '/Users/mhartington/.npmrc'...found.
Trying '/Users/.npmrc'...not found.
Trying '/Users/mhartington/.npmrc'...found.
Trying '/Users/mhartington/myNg7App/.npmrc'...not found.
Updating package.json with dependency @angular/language-service @ "8.0.2" (was "7.2.15")...
Updating package.json with dependency @angular/compiler-cli @ "8.0.2" (was "7.2.15")...
View generate-h2-push.js
#!/usr/bin/env node
const puppeteer = require('puppeteer');
const fs = require('fs');
const args = process.argv.slice(2);
const host = args[0] || 'http://127.0.0.1:8080';
const indexMatches = [
'.gz',
'.map',
'3rdpartylicenses.txt',
'ngsw-manifest.json',
View lazy-img.component.ts
import {
Component,
OnInit,
Input,
ViewChild,
ElementRef,
HostBinding
} from '@angular/core';
@Component({
View titlecase.js
function toTitleCase(str) {
return str.replace(
/\w\S*/g,
txt => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
);
}
View router.md

Angular Router Deep Dive

The Angular Router is one of the most important libraries in an Angular application. Without it, apps would be single view/single context apps. With Angular Router, we can create rich apps that are linkable and have rich animations (when paired with Ionic of course). Let's look at the basics of the Angular Router and how we can configure it for Ionic apps.

A simple Route

For most apps, having some sort of route is often required. The most basic configuration looks a bit like this:

View check-tutorial.service.ts
import { Injectable } from '@angular/core';
import { CanLoad, Router } from '@angular/router';
import { Storage } from '@ionic/storage';
@Injectable({
providedIn: 'root'
})
export class CheckTutorial implements CanLoad {
constructor(private storage: Storage, private router: Router) {}
canLoad() {
View polyfills.ts
/**
* 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
View color.py
from os import path
from denite.source.base import Base
from denite.util import globruntime
from ..kind.command import Kind as Command
from itertools import filterfalse
class Source(Base):
def __init__(self, vim):
View test.html
<div>
<!-- a named slot -->
<slot name="start"></slot>
<p>Here is content from in the component</p>
<!-- default slot, will be used by default -->
<slot></slot>
</div>
<my-component>
You can’t perform that action at this time.