Skip to content

Instantly share code, notes, and snippets.

View chrisstraw's full-sized avatar

Chris Straw chrisstraw

  • OuterLimits Technologies, Inc.
  • Plainfield, IN
  • 11:51 (UTC -04:00)
View GitHub Profile
@chrisstraw
chrisstraw / Dockerfile_mssql
Created January 5, 2024 21:58 — forked from pbthorste/Dockerfile_mssql
Docker image with msssql 2022 with full text search enabled
# Docker image with msssql 2022 with full text search enabled
# based on work in: https://github.com/Microsoft/mssql-docker
# Base OS layer: Latest Ubuntu LTS
FROM --platform=linux/amd64 ubuntu:focal
# Install prerequistes since it is needed to get repo config for SQL server
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -yq curl apt-transport-https gnupg && \
@chrisstraw
chrisstraw / MigrationHelpers
Last active July 27, 2022 15:18
C# helper for SQL Server to change Create to Alter Views and Procedures
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using Microsoft.EntityFrameworkCore.Migrations;
// This class uses extensions from Nuget package https://www.nuget.org/packages/OLT.Extensions.General
@chrisstraw
chrisstraw / EstimatedJurJson.cs
Created April 14, 2022 15:53
Flatten Array to Object using Newtonsoft.Json
public class EstimatedJurJson
{
public int RegYear { get; set; }
public int Distance { get; set; }
}
@chrisstraw
chrisstraw / gist:212626e76c9eafedec24df4c2d106cea
Created February 21, 2022 22:27
Example of Implements<> in OLT.Extensions.General package
this.GetType().Implements<IMyInterface>()
this.GetType().Implements(typeof(IMyInterface<>))
this.GetType().Implements(typeof(IMyInterface<,>))
var regexIso8601 = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
function convertDateStringsToDates(input) {
// Ignore things that aren't objects.
if (typeof input !== "object") return input;
//console.log("transforming", input);
for (var key in input) {
if (!input.hasOwnProperty(key)) continue;
@chrisstraw
chrisstraw / Age.cs
Created February 15, 2014 15:00 — forked from faisalman/Age.cs
/**
* Calculate Age in C#
* https://gist.github.com/faisalman
*
* Copyright 2012-2013, Faisalman <fyzlman@gmail.com>
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
*/
using System;
public class UnhandledExceptionFilter : ExceptionFilterAttribute {
public override void OnException(HttpActionExecutedContext context) {
Elmah.ErrorLog.GetDefault(HttpContext.Current).Log(new Elmah.Error(context.Exception));
}
}