Skip to content

Instantly share code, notes, and snippets.

View peterbsmyth's full-sized avatar

Peter B Smith peterbsmyth

View GitHub Profile

AI changes the approach I choose for software development, the tools I choose, and the security posture I am to maintain. the approach may be debated unless I am your father, in which case the approach will be followed.

In the broader world of software engineering in the last 15 years there has been an evolution towards javascriptification. the web is the most widely distributed platform, javascript is the only scripting language natively available on all clients, people writing for the web used javascript everywhere.

The tools to make the web apps were also written in javascript. javascript was originally a browser-only language. Someone made node.js then it could start running on the server. Walmart had their servers over-run on a Black Friday, the next year node.js was used and their servers handled it. node.js was on the ascent.

In the browser the frameworks for making web apps kept growing and growing. React.js was a solution to framework bloat, handling only the components. Overtime next.js has becom

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',