Skip to content

Instantly share code, notes, and snippets.

View peterbsmyth's full-sized avatar

Peter B Smith peterbsmyth

View GitHub Profile
export async function search(term: string) {
const response = await fetch(
'https://services6.arcgis.com/bdPqSfflsdgFRVVM/arcgis/rest/services/Trash_Day_Schedule/FeatureServer/2/query?where=StName%20%3D%20%27' +
term +
'%27&outFields=*&outSR=4326&f=json'
);
const data = await response.json()
return data;
}
import { Component, OnDestroy, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
import {
BoardCardData,
loadDescendantsFromProgramPage,
openWorkoutModal,
ProgramsFacade,
selectProgramFromPage,
@Injectable()
export class Effects {
getPending$ = createEffect(() =>
this.actions$.pipe(
ofType(ApprovalActions.getAllPendingApprovals),
switchMap(res =>
this.apiService.getAllPendingApprovals()
),
map((approvals) => ApprovalActions.getAllPendingApprovalsComplete({ approvals }))
)
function reqListener() {
var data = JSON.parse(this.responseText);
console.log(data);
}
function reqError(err) {
console.log('Fetch Error :-S', err);
}
var request = new XMLHttpRequest();
@peterbsmyth
peterbsmyth / build.sh
Last active July 14, 2023 05:03
Using Environment Variables at Build for NativeScript
tns build ios --release --bundle --env.launch
@peterbsmyth
peterbsmyth / api.base-service.ts
Created October 29, 2019 14:59
Sharing API Services on Web and Mobile
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Dashboard } from '~/app/models';
@Injectable({
providedIn: 'root'
})
export abstract class ApiBaseService {
@peterbsmyth
peterbsmyth / actions.ts
Created June 1, 2019 23:32
ngrx 8 createEffect
import { createAction, props } from '@ngrx/store';
export const get = createAction(
'[Job] get'
);
export const getComplete = createAction(
'[Job] getComplete',
props<{ job: any }>()
);
@peterbsmyth
peterbsmyth / actions.ts
Last active June 1, 2019 23:23
ngrx 8 `on` function
import { createAction, props } from '@ngrx/store';
export const get = createAction(
'[Job] get'
);
export const getComplete = createAction(
'[Job] getComplete',
props<{ job: any }>()
);
@peterbsmyth
peterbsmyth / new-hotness.ts
Created May 14, 2019 16:52
New ngrx Actions
/*
Read more: https://blog.angularindepth.com/ngrx-action-creators-redesigned-d396960e46da
Description: Alex Okrushko goes in detail on what makes this so good.
*/
import { createAction, props } from '@ngrx/store';
export const submit = createAction(
'[New Expense] submit',
@peterbsmyth
peterbsmyth / cli.sh
Last active March 18, 2019 18:52
sample usages from command line
# Testing
## using @angular-devkit/schematics
schematics .:login --name=snapchat
# Production
## using @angular/cli with shorthand
ng generate @acme/schematics:login snapchat
## using @angular/cli
ng generate @acme/schematics:login --name=snapchat