Skip to content

Instantly share code, notes, and snippets.

View johnw86's full-sized avatar

John Walker johnw86

View GitHub Profile
@johnw86
johnw86 / TimeZoneService.ts
Created June 11, 2024 13:42
Angular IANA time zone service
import { Injectable } from '@angular/core';
const ianaTimeZoneIds = ["Africa/Abidjan", "Africa/Algiers", "Africa/Bissau", "Africa/Cairo", "Africa/Casablanca", "Africa/Ceuta", "Africa/El_Aaiun", "Africa/Johannesburg", "Africa/Juba", "Africa/Khartoum", "Africa/Lagos", "Africa/Maputo", "Africa/Monrovia", "Africa/Nairobi", "Africa/Ndjamena", "Africa/Sao_Tome", "Africa/Tripoli", "Africa/Tunis", "Africa/Windhoek", "America/Adak", "America/Anchorage", "America/Araguaina", "America/Argentina/Buenos_Aires", "America/Argentina/Catamarca", "America/Argentina/Cordoba", "America/Argentina/Jujuy", "America/Argentina/La_Rioja", "America/Argentina/Mendoza", "America/Argentina/Rio_Gallegos", "America/Argentina/Salta", "America/Argentina/San_Juan", "America/Argentina/San_Luis", "America/Argentina/Tucuman", "America/Argentina/Ushuaia", "America/Asuncion", "America/Bahia", "America/Bahia_Banderas", "America/Barbados", "America/Belem", "America/Belize", "America/Boa_Vista", "America/Bogota", "America/Boise", "America/Cambridge_B
@johnw86
johnw86 / utils.css
Created May 30, 2024 10:13
CSS utils
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
@johnw86
johnw86 / ohmyposhv3-v2.json
Created August 22, 2023 08:35 — forked from shanselman/ohmyposhv3-v2.json
ohmyposhv3-v2
{
"final_space": true,
"console_title": true,
"console_title_style": "folder",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 0,
Issue stuck starting
Delete the settings.json file from %AppData%\Docker, restart machine.
@johnw86
johnw86 / kusto.txt
Last active October 8, 2024 20:06
Kusto Queries
// Get top 5 storm types causing any damage in the state of Virginia during april
StormEvents
| where State == "VIRGINIA"
| where StartTime >= datetime(2007, 04, 01) and EndTime < datetime(2007, 05, 01)
| project EventType, Damage=DamageCrops+DamageProperty
| top 5 by Damage
// Count all records
StormEvents
| count
@johnw86
johnw86 / InstaStory.jsx
Created May 10, 2022 12:56
Instagram Story CDN Handling
import logo from './logo.svg';
import './App.css';
import React from 'react';
function App() {
const [showVideo, setShowVideo] = React.useState(true);
const [showImage, setShowImage] = React.useState(true);
const cdnLink = "https://lookaside.fbsbx.com/ig_messaging_cdn/?asset_id=18041239177335195&signature=AbyRRJJOrhzZVtk5I4R-Y68YJOtVRq0ee5bet-gMDsTwgsS2iWKM6qZakxyOUDnFbt8t1ehbsQo6-ZsrYGzl6g1pX3dc7SCX6BfxPz93Q22xINr2NLaMzhK6qMZ8-pi1Ev9V_8yyer3CQwEX0IbjFsA3qvcVKTL_W9LTf1YA7uILkb-k";
@johnw86
johnw86 / spflookup.cs
Created September 18, 2020 10:38
SFP Lookup
// Using DnsClient nuget package
var client = new LookupClient();
var textRecords = client.Query("google.com", QueryType.TXT).AllRecords.TxtRecords();
var spfRecords = textRecords.Where(x => x.EscapedText.Any(t => t.Contains("spf")));
foreach (var spfRecord in spfRecords)
{
foreach (var text in spfRecord.EscapedText)
@johnw86
johnw86 / git.txt
Last active July 29, 2020 18:39
git Commands
Update gitignore and remove committed files that should no longer be in source control
git rm -r --cached .
git add .
git commit -m ".gitignore fix"
@johnw86
johnw86 / gist:f71c6f0cca84a8f34e281ac8f657c77a
Created July 11, 2019 15:25
Unit tests with IConfiguration
var myConfiguration = new Dictionary<string, string>
{
{"Age", "18"},
{"Nested:Property", "1"},
};
var configuration = new ConfigurationBuilder()
.AddInMemoryCollection(myConfiguration)
.Build();
@johnw86
johnw86 / launch.json
Last active August 10, 2021 11:38
Jest test runner config. VS code
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest All",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["--runInBand"],
"console": "integratedTerminal",