Skip to content

Instantly share code, notes, and snippets.

View peterbsmyth's full-sized avatar

Peter B Smith peterbsmyth

View GitHub Profile
import { Component, OnInit } from '@angular/core';
import { UserService } from './user.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
@Injectable()
export class SkillsService {
constructor(private http: Http) { }
getSkills() {
return this.http.get('localhost:3000/skill/');
import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import { environment } from '../environments/environment';
@Injectable()
export class SkillsService {
constructor(private http: Http) { }
getSkills() {
export const environment = {
production: false,
apiUrl: 'http://localhost:1337'
};

Why should you have a Browser Application behind a VPN?

Intro

Your company runs on a private network. Your employees access that network from home using a VPN. Every day your company relies on that connection to keep your data safe.

Definitions

Web: The public web is the collection of sites that start have a www prefix.
VPN: The private network that your company firewalls it's sensitive data behind.
Browser Application: Any application that runs in a web browser such as Chrome, Internet Explorer, Edge, and Firefox.

@peterbsmyth
peterbsmyth / github.effects.ts
Last active November 6, 2017 18:14
Showing an architectural question
import { Injectable } from '@angular/core';
import { Effect, Actions } from '@ngrx/effects';
import { Action } from '@ngrx/store';
import { Observable } from 'rxjs/Observable';
import { Scheduler } from 'rxjs/Scheduler';
import { of } from 'rxjs/observable/of';
import { handleError } from './handleError';
import { GithubService } from '../services/github.service';
@peterbsmyth
peterbsmyth / post-data.json
Last active December 13, 2017 18:49 — forked from djowinz/post-data.json
Account Creation: Pro
{
"legal_entity.address.city": "CA",
"legal_entity.address.line1": "56 Bridgeport Street",
"legal_entity.address.line2": "",
"legal_entity.address.postal_code": "92629",
"legal_entity.address.state": "California",
"legal_entity.dob.day": 26,
"legal_entity.dob.month": 8,
"legal_entity.dob.year": 1992,
"legal_entity.ssn_last_4": 0000,

Thank You For Arguing / Rhetoric of The Wire Companion

Argument Tool: THE ADVANTAGEOUS: Base your argument on what's good for the audience, not for you.

Cicero's Outline

Introduction

The ethos part, which wins you the "interest and the good will of the audience," as Cicero puts it. (He calls this section the exordium.)

@peterbsmyth
peterbsmyth / user.reducer.ts
Last active January 5, 2018 16:47
ngRx practice
import * as userActions from '../actions/user';
import * as skillActions from '../actions/skill';
export interface State {
user: {
isPro: boolean;
skills: any[];
id;
cards: any[];
};
@peterbsmyth
peterbsmyth / recipe.example.md
Last active May 21, 2020 13:39
Making chained API Calls using @ngrx/Effects

Making chained API Calls using @ngrx/Effects

Purpose

This recipe is useful for cooking up chained API calls as a result of a single action.

Description

In the below example, a single action called POST_REPO is dispatched and it's intention is to create a new repostiory on GitHub then update the README with new data after it is created.
For this to happen there are 4 API calls necessary to the GitHub API:

  1. POST a new repostiry
  2. GET the master branch of the new repository
  3. GET the files on the master branch