Skip to content

Instantly share code, notes, and snippets.

Stephen Fluin StephenFluin

Block or report user

Report or block StephenFluin

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 lazy-images.directive.ts
import { Directive, ElementRef } from '@angular/core';
@Directive({
selector: 'img'
})
export class LazyImagesDirective {
constructor(ref: ElementRef) {
ref.nativeElement.loading = 'lazy';
}
@StephenFluin
StephenFluin / contributors.md
Last active May 28, 2019
8.0.0 Contributors
View contributors.md

angular/angular

Adam Bradley, Adam Plumer, Adam Yi, Ahsan Ayaz, Alan, Alan Agius, Alberto Garza, Alex Eagle, Alexey Zuev,

View emits.ts
import { Component, Output } from '@angular/core';
import { Subject } from 'rxjs';
@Compnent({
template: '<child-component (myCustomEvent)="myOtherEvent.next($event)"></child-component>',
})
export class EmitComponent {
@Output() myOtherEvent = new Subject<any>();
}
@StephenFluin
StephenFluin / angular-install.sh
Created Jul 11, 2018
Install Angular on a *nix system
View angular-install.sh
# NVM
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
nvm install 10
# Yarn
curl -o- -L https://yarnpkg.com/install.sh | bash
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
View test.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path = require("path");
const ts = require("typescript");
const plugin_1 = require("./plugin");
const refactor_1 = require("./refactor");
const loaderUtils = require('loader-utils');
const NormalModule = require('webpack/lib/NormalModule');
// This is a map of changes which need to be made
const changeMap = {
View md-select
<div>
From: {{from}}
<md-select [(ngModel)]="from">
<md-option value="200">2.0</md-option>
<md-option value="201">2.1</md-option>
<md-option value="202">2.2</md-option>
<md-option value="203">2.3</md-option>
<md-option value="204">2.4</md-option>
<md-option value="400">4.0</md-option>
<md-option value="500">5.0</md-option>
@StephenFluin
StephenFluin / generate-http2-push-headers.js
Created Mar 20, 2017
NodeJS Command to generate firebase compatible headers for your Angular app
View generate-http2-push-headers.js
fs = require('fs');
fs.readdir('dist/', (err, files) => {
files = files.filter(file => {
if(file.indexOf('.gz') != -1) {
return false;
}
if(file.indexOf('favicon') != -1) {
return false
}
@StephenFluin
StephenFluin / try-angular-upgrade.sh
Created Mar 10, 2017
Give the 2.4.x to 4.0.0-rc upgrade a try!
View try-angular-upgrade.sh
ng new my-project
cd my-project
# We have a working v2.4.x project now!
ng build -prod
# Let's save a working copy of the 2.4.x project
mv dist dist-2.4.x
# Now let's update to the latest version of Angular
@StephenFluin
StephenFluin / npm-link.sh
Last active Mar 7, 2017
Angular package switching
View npm-link.sh
@StephenFluin
StephenFluin / md-input-fix.html
Last active Feb 22, 2017
Regex to update your md-input tags
View md-input-fix.html
<!-- regex this with that -->
<md-input (.*)></md-input>
<md-input-container><input mdInput $1></md-input-container>
You can’t perform that action at this time.