Skip to content

Instantly share code, notes, and snippets.

View lukencode's full-sized avatar
🙃

Luke Lowrey lukencode

🙃
View GitHub Profile
CREATE PROCEDURE spNextStudySequence
@StudyID int
AS
DECLARE @temp table
(
ID bigint
);
UPDATE tStudy_Sequences
SET Sequence = Sequence + 1
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<PropertyGroup>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<VersionPatch>0</VersionPatch>
<ChangesetNumber>0</ChangesetNumber>
<NugetFileShare>\\itsmanv01\Releases</NugetFileShare>
<SolutionPath>RequisitioningSolution.sln</SolutionPath>
Write-Host "Looking for " $OctopusPackageDirectoryPath "app_offline*.htm*"
if(Test-Path $OctopusPackageDirectoryPath\app_offline*.htm*)
{
ren $OctopusPackageDirectoryPath\app_offline*.htm* app_offline.htm
}
@lukencode
lukencode / octobuild.build
Created February 7, 2013 03:22
Octopack build script
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<PropertyGroup>
<DeployFiles>$(MSBuildStartupDirectory)\DeployFiles.msbuild</DeployFiles>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<VersionPatch>0</VersionPatch>
<ChangesetNumber>0</ChangesetNumber>
<NugetFileShare>\\itsmanv01\Releases</NugetFileShare>
@lukencode
lukencode / widget.js
Last active December 7, 2021 19:16
Starter template for creating jsonp embeddable widgets.
(function () {
var scriptName = "embed.js"; //name of this script, used to get reference to own tag
var jQuery; //noconflict reference to jquery
var jqueryPath = "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js";
var jqueryVersion = "1.8.3";
var scriptTag; //reference to the html script tag
/******** Get reference to self (scriptTag) *********/
var allScripts = document.getElementsByTagName('script');
@lukencode
lukencode / Hierarchyize.cs
Last active October 13, 2015 17:17
I have know idea if this will work...
public static class Hierarchyize
{
public static List<Nested<T>> Transform<T>(IEnumerable<T> items, Func<T, T, bool> isParentFunction, Func<T, bool> isRootFunction)
{
Action<Nested<T>> setChildren = null;
setChildren = parent =>
{
parent.Children = items
.Where(childItem => isParentFunction(childItem, parent.Item))
@lukencode
lukencode / ListDiff.cs
Last active October 11, 2015 23:28
Quick class for determining changes (additions, removals) in lists
public static class ListDiff
{
public static List<ListDiffItem<T>> GetDiff<T>(List<T> oldList, List<T> newList, Func<T, T, bool> equalsFunction = null)
{
var combined = new List<ListDiffItem<T>>();
foreach(var i in newList)
{
var diff = new ListDiffItem<T>();
diff.Item = i;
@lukencode
lukencode / gist:2849237
Created June 1, 2012 05:45
thinkin fillr
public class NameFiller : IPropertyFiller<string>
{
private Random _rand;
private static Regex _combinedRegex = new Regex("name|fullname|firstname|lastname|surname|middlename|maidenname", RegexOptions.IgnoreCase);
private static Regex _fullNameRegex = new Regex("name|fullname", RegexOptions.IgnoreCase);
private static Regex _firstNameRegex = new Regex("firstname|middlename", RegexOptions.IgnoreCase);
private static Regex _surnameRegex = new Regex("lastname|surname|maidenname", RegexOptions.IgnoreCase);
private static List<string> _firstNames = new List<string> { "Luke", "John", "Mary" };
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NSpark
{
public static class SparkExtensions
{
public static String Spark(this string input)
@lukencode
lukencode / CacheExtensions.cs
Created December 9, 2011 00:46
CacheExtensions
public static class CacheExtensions
{
static object sync = new object();
/// <summary>
/// Executes a method and stores the result in cache using the given cache key. If the data already exists in cache, it returns the data
/// and doesn't execute the method. Thread safe, although the method parametersn't guaranteed to be thread safe.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="cache"></param>