View generateUUID.js
function generateUUID() {
var d = new Date().getTime();
if (window.performance && typeof window.performance.now === "function") {
d += performance.now();; //use high-precision timer if available
}
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
View Model1.cs
namespace ComplexEntityFramework
{
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
public class Model1 : DbContext
{
public Model1()
: base("name=Model1")
View FindRemoveDuplicates.sql
-- SQL databate table dbo.Test with columns Id, FirstName, LastName, TransactionNumber, LastUpdatedDate
-- Select rows that are duplicates without using LastUpdatedDate
-- If needed can insert into a backup/archive table
SELECT t.Id, t.FirstName, t.LastName, t.TransactionNumber, t.LastUpdatedDate
FROM dbo.Test t
LEFT OUTER JOIN (
SELECT MIN(Id) as Id,
FirstName, LastName, TransactionNumber
FROM dbo.Test
View projectsetupdescription.txt
Application.Core
This namespace should contain all functionality that is not expansive enough to be in its own project but are required by multiple consumers/projects
- Logging and other cross access functions
- Generic helper classes for logging.
- Non-domain specific, independent functionality, and Profiling. Such as .NET Extension methods.
Application.Domain
This namespace contains the domain objects.
- Domain Objects (POCO), Shared data transfer objects, Models, ViewModels, etc
- Business logic for Validators, Filters, Factories, Regular expressions
Application.Data
View gist:dd539a1ebff2d6b3bd0bb32f3007d0a6
### Keybase proof
I hereby claim:
* I am andyconlisk on github.
* I am kingpancake (https://keybase.io/kingpancake) on keybase.
* I have a public key ASALMMqf4SM6CNyfc95F_w2_aYcKnvvdEA9bENXjbTLrlAo
To claim this, I am signing this object:
View combinemultiplerowintoone.sql
SELECT p.Name, substring
((SELECT ', ' + k.Number FROM dbo.Keys k
JOIN dbo.Keys_Assignments ka ON ka.KeyID = k.KeyID
WHERE ka.PersonID = p.PersonID
FOR XML PATH('')), 2, 1000) [Keys]
FROM dbo.People p
SELECT k.Number, SUBSTRING
((SELECT '; ' + p.Name FROM dbo.People p
View sql_findTableUsageInStoredProc
SELECT DISTINCT so.name FROM syscomments sc INNER JOIN sysobjects so on sc.id=so.id WHERE sc.text LIKE '%utility%'
View ProductRandomImage.sql
SELECT b.Id AS BusinessId, COALESCE(subCategoryImage.Id, parentCategoryImage.Id) AS ImageAssetId, COALESCE(subCategoryImage.CategoryId, parentCategoryImage.CategoryId) AS CategoryId, b.Name, COALESCE(subCategoryImage.FileName, parentCategoryImage.FileName) AS FileName
FROM Businesses b
OUTER APPLY (
SELECT TOP 1 *
FROM ImageAssets
WHERE CategoryId = b.CategoryId
AND Deleted = 0
ORDER BY CHECKSUM(NEWID(), b.id) & 2147483647
) subCategoryImage
OUTER APPLY (
View Background.cs
//Easy Background tasks in ASP.NET projects
//Inspiration from http://blog.stackoverflow.com/2008/07/easy-background-tasks-in-aspnet/
//This code is added into the Global.asax file. In the Application_Start() method
private static CacheItemRemovedCallback OnCacheRemove = null;
protected void Application_start()
{
//The register code that is put in here
//Here is where you add all the tasks you want to start on application start