Skip to content

Instantly share code, notes, and snippets.

View Grax32's full-sized avatar
๐Ÿ˜Ž
Secure Developer / Florida

David Walker Grax32

๐Ÿ˜Ž
Secure Developer / Florida
View GitHub Profile
type LimitedLifeNode = { name: string, notBefore: Date | null, notAfter: Date | null };
type LimitedLifeNodeWithChildren = LimitedLifeNode & { children?: LimitedLifeNodeWithChildren[]}
function minDate(dates: Date[]) {
const datesWithValues = dates.filter(d => d);
if (!datesWithValues.length) {
return null;
}
@Grax32
Grax32 / json-closer.js
Last active October 9, 2023 11:34
Auto-Close JSON
/*
Provided that the beginning of the JSON document is present in the fragment, this function will automatically close JSON fragments.
*/
function jsonCloser(src) {
const openChars = [];
let inQuotedString = false;
for (let i = 0; i < src.length; i++) {
const thisChar = src[i];
if (inQuotedString) {
switch (thisChar) {
@Grax32
Grax32 / cloudSettings
Created April 8, 2018 12:23
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-04-08T12:22:32.382Z","extensionVersion":"v2.9.0"}
@Grax32
Grax32 / gist:5477058
Created April 28, 2013 14:37
A FakeDbSet that implements IDbSet<T> and uses IList<T> for data manipulation
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;