Skip to content

Instantly share code, notes, and snippets.

Jess Lilly jesslilly

  • US
Block or report user

Report or block jesslilly

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jesslilly
jesslilly / drop.sql
Created Nov 29, 2018
DROP ALL SQL SERVER TABLES
View drop.sql
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 / Program.cs
Created May 22, 2018
HttpClient.cs Authentication Error?
View Program.cs
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleTestApp1
{
class Program
{
@jesslilly
jesslilly / BuildingDbContextFactory.cs
Created Apr 9, 2018
Simple IDesignTimeDbContextFactory example
View BuildingDbContextFactory.cs
public class FooDbContextFactory : IDesignTimeDbContextFactory<FooDbContext>
{
public FooDbContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder<FooDbContext>();
optionsBuilder.UseSqlServer("DeaultConnection");
return new FooDbContext(optionsBuilder.Options);
}
}
View gist:e6ccf70736bc1a8ae9abe5afc212c1de
Vue.directive('on-show-bs-tab', {
bind: function (el, binding) {
// This is BS4 jQuery
// When the tab is activated, load the data!
$(el).on('show.bs.tab', function (e) {
if (typeof binding.value === "function") {
binding.value.call();
}
});
}
@jesslilly
jesslilly / CampaignMonitor.cs
Created Oct 10, 2017
Get all list names and list IDs from Campaign Monitor (createsend_dotnet)
View CampaignMonitor.cs
[TestMethod]
public void PrintListIds()
{
PrintListIds("key", "id");
PrintListIds("key", "id");
PrintListIds("key", "id");
}
private static void PrintListIds(string apiKey, string clientId)
{
View SimMetricsMetricUtilities_JaroWinkler_Bug.cs
[Test]
public void GetSimilarity_SpaceInTarget_NotZero()
{
var matcher = new SimMetricsMetricUtilities.JaroWinkler();
var target = " 1 main";
var candidate = "1 main st";
var similarity = matcher.GetSimilarity(candidate, target);
var message = string.Format("Expect similarity {0} to be > .9", similarity);
Assert.IsTrue(similarity > .90, message);
@jesslilly
jesslilly / README.md
Last active Aug 5, 2019
Deluxe Cron Job Wrapper
View README.md

Cron Job Wrapper Wish List

I want a script that will give me:

  1. Logging
  2. Log purging!
  3. Email errors!
  4. Prevent duplicate processes! (flock)
  5. Source an environment file!
  6. Anything else?
@jesslilly
jesslilly / InMemorySet.cs
Last active Sep 26, 2017
Need to Mock a DbSet for testing Entity Framework? View the README.md file below.
View InMemorySet.cs
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
namespace FCM.Web.Tests.TestHelpers
{
@jesslilly
jesslilly / AuditableEntity.cs
Last active Aug 29, 2015
Implementing a Base Class with Entity Framework
View AuditableEntity.cs
namespace My.Models.BaseModels
{
public class AuditableEntity
{
public int Id { get; set; }
public DateTime CreatedDt { get; set; }
public string CreatedBy { get; set; }
public DateTime RevisedDt { get; set; }
public string RevisedBy { get; set; }
}
View HttpPost_Controller.cs
[HttpPost]
public ActionResult ConfirmLink(string id)
{
try
{
var confirmationMessage = SomeRepo.ConfirmLink(id);
return Json(new { confirmationMessage = confirmationMessage }, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
You can’t perform that action at this time.