This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// reflection in typescript | |
const fida = { | |
fName: 'Fida', | |
lName: 'Haq', | |
age: 28 | |
} | |
class ReflectionClass { | |
[property: string]: string | number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Pipe, PipeTransform } from '@angular/core'; | |
@Pipe({ | |
name: 'templateLogger', | |
}) | |
export class TemplateLoggerPipe implements PipeTransform { | |
transform(value: any) { | |
console.log('TEMPLATE LOGGER: ', value) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Guid { | |
public static validator = new RegExp("^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$", "i"); | |
public static EMPTY = "00000000-0000-0000-0000-000000000000"; | |
public static isGuid(guid: any) { | |
const value: string = guid.toString(); | |
return guid && (guid instanceof Guid || Guid.validator.test(value)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const https = require('https') | |
async function fetch(url) { | |
return new Promise((resolve, reject) => { | |
const request = https.get(url, { timeout: 1000 }, (res) => { | |
if (res.statusCode < 200 || res.statusCode > 299) { | |
return reject(new Error(`HTTP status code ${res.statusCode}`)) | |
} | |
const body = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"hours": [ | |
{ | |
"airTemperature": { | |
"noaa": 26.61 | |
}, | |
"time": "2023-06-06T00: 00: 00+00: 00" | |
}, | |
{ | |
"airTemperature": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requires WSL2 on windows | |
# Required windows config | |
# --------------------------------- | |
## in powershell run | |
# wsl --set-default-version 2 | |
## to set wsl 2 as default | |
# --------------------------------- | |
## Then run | |
# wsl -l -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 1. INTRODUCTION | |
/* | |
This script drops all fk constraints and tables from a configured scema. | |
*/ | |
/*---------------------------*/ | |
/* 2. CONFIGURATION */ | |
/*---------------------------*/ | |
declare @schema varchar(52) = 'dbo'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Injectable} from '@angular/core'; | |
import {NavigationEnd, Router, RouterEvent} from "@angular/router"; | |
import {filter} from "rxjs/operators"; | |
import {Subscription} from "rxjs"; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class TrackUrlHistoryService { | |
/* PROPERTIES */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": [ | |
{ | |
"Name":"Kobus", | |
"Age": 340, | |
"Company":["Infinity Arc"] | |
}, | |
{ | |
"Name": "Cliff", | |
"Age":903, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "Afghanistan", | |
"dial_code": "+93", | |
"code": "AF" | |
}, | |
{ | |
"name": "Aland Islands", | |
"dial_code": "+358", | |
"code": "AX" |
NewerOlder