Skip to content

Instantly share code, notes, and snippets.

@jesslilly
jesslilly / drop.sql
Created November 29, 2018 21:10
DROP ALL SQL SERVER TABLES
BEGIN -- Delete all tables in order to re-create.
DECLARE @sql NVARCHAR(MAX);
SET @sql = N'';
SELECT @sql = @sql + N'
ALTER TABLE ' + QUOTENAME(s.name) + N'.'
+ QUOTENAME(t.name) + N' DROP CONSTRAINT '
+ QUOTENAME(c.name) + ';'
FROM sys.objects AS c
INNER JOIN sys.tables AS t
@jesslilly
jesslilly / HtmlSanitizerTests.cs
Created January 31, 2020 14:22
MSTEST Stub for Ganss.XSS.HtmlSanitizer. Test your config.
using Ganss.XSS;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace VEIC.Tracker.Services.Tests.Shared
{
[TestClass]
public class HtmlSanitizerTests
{
private IHtmlSanitizer _htmlSanitizer;
@jesslilly
jesslilly / !jQuery Functions
Last active April 30, 2020 20:48
Some jQuery to do various common things
Using this file to rename the gist
@jesslilly
jesslilly / AttributeCrudCommands.cs
Last active March 14, 2024 18:04
Jess Lilly Sample Code .NET 6 MVC
using Domain.Toolkit;
using Domain.Sample.AppModels.Attributes;
using Domain.Sample.DbModels.Sample;
namespace Domain.Sample.Services.Attributes;
public class AttributeCrudCommands : IAttributeCrudCommands
{
private readonly SampleDbContext _db;
private readonly ILogger<AttributeCrudCommands> _logger;
@jesslilly
jesslilly / ProductControl.cs
Last active August 11, 2023 17:09
How would you refactor this code?
using System.Collections.ObjectModel;
using System.Runtime.CompilerServices;
using System.Security.Cryptography.X509Certificates;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace MyApplication.Web.Controllers
{
public class ProductControl : Controller
{