Skip to content

Instantly share code, notes, and snippets.

View TomDeMille's full-sized avatar

Tom DeMille TomDeMille

  • Tranquila CTO
  • Charleston South Carolina
View GitHub Profile
@TomDeMille
TomDeMille / ParseCSProjFiles.cs
Last active January 4, 2016 06:08
Linqpad script to parse a directory of .csproj files and dump information about references, both dll and project references, ordered by name and count. Check the to variables at the top, you can display more detail and change from dll to project references by flipping the bit.
//iterate a folder and subfolders, find all .csproj files, find all references, count references (by version)
//requires System.Collections.Generic and System.Linq.Queryable
//see each proj or just the statistics?
var showDetail = false;
var projRefs = false;
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(@"C:\Code\Boomtown");
IEnumerable<System.IO.FileInfo> fileList = dir.GetFiles("*.csproj", System.IO.SearchOption.AllDirectories);
@TomDeMille
TomDeMille / testDriver.scala
Created April 19, 2016 15:21
Scala Test Utils for Contact Service (Boomtown)
package com.boomtownroi.services.contact
import com.boomtownroi.services.contact.db.{Contacts, SortBy}
import scala.concurrent.Await
import scala.concurrent.duration.Duration
/**
* Created by tdemille on 4/19/16.
* can run from sbt console like this
@TomDeMille
TomDeMille / Most Efficient Query Fix
Last active August 31, 2018 16:22
Most Efficient Query Fix
The problem when sorting by assigned date and limiting by userid was that the cross apply was creating a huge amount of IO,
running for each row in the resultset. By using an inner join the result set is limited further up the chain so to speak,
the cross apply remains in order to 'select distinct' (but on an already reduced result set).
See row 32 for the inner join, cross apply remains
note on row 53 we are ordering by contactuser from the join, not the cross apply
SELECT C.ContactId ,
@TomDeMille
TomDeMille / another more efficient way
Created August 31, 2018 16:21
another more efficient way
This one drops the cross apply and uses to LEFT JOIN to accomplish the same thing
This does not seem to be as efficient as the combination of one join and one cross apply
But is still MUCH more efficient than just using the cross apply
Rows 30 and 31 have the two joins
SELECT C.ContactId ,
C.TenantID ,
C.WebVisitorID ,
C.FirstName ,
@TomDeMille
TomDeMille / BEST fix (if we can limit by typeid)
Created August 31, 2018 16:56
BEST fix (if we can limit by typeid)
SELECT C.ContactId ,
C.TenantID ,
C.WebVisitorID ,
C.FirstName ,
C.LastName ,
( SELECT TOP 1
Name
FROM LeadSource
WHERE Alias = WebDetail.OriginalSource
) AS SourceName ,
@TomDeMille
TomDeMille / offensive names
Created October 3, 2018 12:27
offensive names
export default [
'anal',
'analannie',
'analsex',
'angie',
'angry',
'anus',
'areola',
'argie',
'aroused',