Skip to content

Instantly share code, notes, and snippets.

@crmckenzie
crmckenzie / FakeLocalStorage
Created July 22, 2014 18:03
FakeLocalStorage
define([], function() {
function FakeLocalStorage() {
var self = this;
self.length = 0;
self.keys = [];
return self;
}
@crmckenzie
crmckenzie / gist:f9eb2e7a59f3318e5bb7
Created August 19, 2014 21:06
Analyze your PATH variable
$path = $env:Path.Split(';') | Where-Object {[string]::IsNullOrWhiteSpace($_) -eq $false } | Sort-Object { $_ }
"Paths that do not exist"
$pathsThatDoNotExist = $path | Where-Object {[System.IO.Directory]::Exists($_) -eq $false}
$pathsThatDoNotExist
""
""
""
"Scrubbed path variable"
@crmckenzie
crmckenzie / gist:d7bbe1be5519f27449e8
Created October 23, 2014 18:55
Reload Powershell Module
Function Reload-Module($ModuleName)
{
$module = Get-Module $ModuleName
$path = $module.Path
"removing $ModuleName"
Remove-Module $ModuleName
"importing $path"
Import-Module $path
@crmckenzie
crmckenzie / .vimrc
Last active August 29, 2015 14:13
.vimrc
" no one cares about vi... poor vi
set nocompatible
" vundle setup
filetype on " required on Mac
filetype off
let is_windows=has('win32')
set runtimepath+=~/.vim/bundle/vundle.vim
@crmckenzie
crmckenzie / BadApiDesign.cs
Created August 15, 2012 20:47
Bad Batch API Design
public interface IRecordProcessor
{
Response Process(Record[] records);
}
public class Response
{
public bool Success { get; set; }
}
@crmckenzie
crmckenzie / Install-VSCommandPrompt.ps1
Last active October 8, 2015 17:18
Install-VSCommandPrompt
function Install-VSCommandPrompt($version = "2013")
{
switch ($version)
{
2013 { $toolsVersion = "120" }
2012 { $toolsVersion = "110" }
2010 { $toolsVersion = "100" }
2008 { $toolsVersion = "90" }
2005 { $toolsVersion = "80" }
@crmckenzie
crmckenzie / gist:3990195
Created October 31, 2012 21:56
Bootstrapping Isg.EntityFramework.ObservableProvider
ObservableProviderConfiguration.RegisterProvider("System.Data.SqlServerCe.4.0", setAsDefault:true);
@crmckenzie
crmckenzie / gist:3994421
Created November 1, 2012 15:37
Consuming global ObservableDbProvider events
Hub.ConnectionOpening += (sender, args) =>
{
// your code here
};
Hub.ConnectionClosing += (sender, args) =>
{
// your code here
};
@crmckenzie
crmckenzie / gist:4004375
Last active October 12, 2015 09:08
Powershell script to ilmerge a project. Useful in TeamCity
<#
.SYNOPSIS
IlMerges an assembly with its dependencies. Depends on nuget being installed in the PATH.
.PARAMETER targetProject
The name of the project to be ilmerged
.PARAMETER outputAssembly
The name of the ilmerged assembly when it is created
public interface IRepository : IDisposable
{
IQueryable<T> Find<T>() where T: class;
T Get<T>(object key) where T : class;
void Save(object value);
void Delete(object value);