Skip to content

Instantly share code, notes, and snippets.

Learning React, writing "Angular for dads"

William Ghelfi trumbitta

Learning React, writing "Angular for dads"
Block or report user

Report or block trumbitta

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 http-error.interceptor.ts
export class HttpErrorInterceptor implements HttpInterceptor {
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
return next.handle(request).pipe(
tap(
() => {},
error => {
// There may be other events besides the response error.
if (
error instanceof HttpErrorResponse
) {
@trumbitta
trumbitta / greeting-card.component.ts
Last active Mar 29, 2019
Angular for dads - Intro to components: passing data
View greeting-card.component.ts
import { Component, Input } from '@angular/core';
@Component({
selector: 'ng4d-greeting-card',
template: `
<article>
<h1>Hello, I'm {{ name }}!</h1>
<p>And I'm a {{ age }} years old dad.</p>
</article>
`,
@trumbitta
trumbitta / greeting-card.component.ts
Created Mar 20, 2019
Angular for dads - Intro to components 2
View greeting-card.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'ng4d-greeting-card',
template: `
<article>
<h1>Hello, I'm William!</h1>
<p>And I'm a 41 years old dad.</p>
</article>
`,
@trumbitta
trumbitta / greeting-card.component.ts
Last active Mar 20, 2019
Angular for dads - intro to components 1
View greeting-card.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'ng4d-greeting-card',
template: `
<pre>GreetingCardComponent</pre>
`,
})
export class GreetingCardComponent {}
@trumbitta
trumbitta / app.component.ts
Created Mar 18, 2019
Angular for dads - first steps
View app.component.ts
/** @format */
import { Component } from '@angular/core';
@Component({
selector: 'ng4d-root',
template: `
<article>
<h1>Hello, I'm William!</h1>
<p>And I'm a 41 years old dad.</p>
View 030_update_platform_config.js
#!/usr/bin/env node
/** This hook updates platform configuration files based on preferences and config-file data defined in config.xml.
Currently only the AndroidManifest.xml and IOS *-Info.plist file are supported.
Prerequistes:
npm install -D lodash elementtree plist
See http://stackoverflow.com/questions/28198983/ionic-cordova-add-intent-filter-using-config-xml
@trumbitta
trumbitta / home.html
Last active May 19, 2017
Something I've been doing several times a day with Angular and ngOnInit() since September 2016
View home.html
<ion-header>
<ion-navbar>
<ion-title>
My App
</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
Ok: {{ userFirstName }} <!-- Pluto -->
View Failed update
private imageSrc: string;
ngOnInit() {
this.imageSrc = 'default value';
this.subscription = this.imageService.getRemoteUrl$(this.componentData).subscribe((url) => {
console.log('QUAAAAACK pre', this.imageSrc);
this.imageSrc = url;
console.log('QUAAAAACK post', this.imageSrc);
@trumbitta
trumbitta / kik-check.sh
Created Mar 23, 2016
Find out if a module involved in the "kik npm incident" is in your dependency list
View kik-check.sh
#!/bin/bash
NPM_DEPS_FILE=".npm-deps-parseable.txt"
KIK_MODULES_FILE=".kik-modules.txt"
echo "Downloading kik incident modules list..."
wget https://gist.githubusercontent.com/azer/db27417ee84b5f34a6ea/raw/50ab7ef26dbde2d4ea52318a3590af78b2a21162/gistfile1.txt -O $KIK_MODULES_FILE
wait $!
echo "Building dependency list..."
npm ls --parseable > $NPM_DEPS_FILE
@trumbitta
trumbitta / yeah.config.js
Created Jan 30, 2015
Angular testing with constant
View yeah.config.js
angular.module('wiz.config', [])
.constant('ENV', {URL:{FULL:'http://localhost:1337'}})
;
You can’t perform that action at this time.