Skip to content

Instantly share code, notes, and snippets.

View mikesigs's full-sized avatar
😁

Mike Sigsworth mikesigs

😁
View GitHub Profile
public class FeatureViewLocationRazorViewEngine : RazorViewEngine
{
public FeatureViewLocationRazorViewEngine()
{
ViewLocationFormats = new[]
{
"~/Features/{1}/{0}.cshtml",
"~/Features/{1}/{0}.vbhtml",
"~/Features/Shared/{0}.cshtml",
"~/Features/Shared/{0}.vbhtml",
@mikesigs
mikesigs / git.lua
Created January 20, 2015 05:15
Added remote status (ahead/behind) to ConEmu prompt
---
-- This file is intended to be used with cmder
-- http://bliker.github.io/cmder/
--
-- Replace your existing <path_to_cmder>\config\git.lua with this file
-- This will append the branch status to your prompt, e.g. [ahead 1, behind 2]
-- It basically takes the output of git status -sb and appends it (with coloring) to the cmder prompt (before the lambda)
---
---
@mikesigs
mikesigs / DevEnvironment.ps1
Created December 9, 2015 19:47 — forked from johnkattenhorn/DevEnvironment.ps1
Boxstarter Script for VM-based Development Environment
function SetPowerPlan([string]$PreferredPlan)
{
Write-Host "Setting Powerplan to $PreferredPlan"
$guid = (Get-WmiObject -Class win32_powerplan -Namespace root\cimv2\power -Filter "ElementName='$PreferredPlan'").InstanceID.tostring()
$regex = [regex]"{(.*?)}$"
$newpowerVal = $regex.Match($guid).groups[1].value
# setting power setting to high performance
powercfg -S $newpowerVal
}
######## Phil's dev VM boxstarter script ########
###############
#### notes ####
###############
### running remotely on VM fails on Configuring CredSSP settings
## check http://blogs.technet.com/b/heyscriptingguy/archive/2012/12/30/understanding-powershell-remote-management.aspx
### running locally on VM
@mikesigs
mikesigs / DependenciesVisualizer.linq
Created February 2, 2016 16:48 — forked from plaurin/DependenciesVisualizer.linq
LinqPad query to generate a DMGL of projects, libraries and NuGet packages dependencies
<Query Kind="Program" />
private string[] projectExtensionExclusions = new[] { ".vdproj", ".ndproj", ".wdproj", ".shfbproj" };
private string rootFolder = @"C:\Users\Pascal\Dev\MyProject";
void Main()
{
LoadAllProjects();
LoadAllPackagesConfig();
GenerateDGML(Path.Combine(rootFolder, "Dependencies.dgml"));
@mikesigs
mikesigs / NonEF_DatabaseFixture.cs
Last active February 19, 2016 23:06
xUnit2 DatabaseFixture that Drops and Creates LocalDb
public class DatabaseFixture
{
private readonly string DataDirectory = AppDomain.CurrentDomain.BaseDirectory;
private const string DatabaseName = "TestDb";
private const string DbFilename = DatabaseName + ".mdf";
private const string DbLogFilename = DatabaseName + "_log.ldf";
private const string TestDbConnectionStringName = "TestDb";
private const string MasterDbConnectionStringName = "MasterDb";
private string DbPath => Path.Combine(DataDirectory, DbFilename);
private string DbLogPath => Path.Combine(DataDirectory, DbLogFilename);
@mikesigs
mikesigs / build.fsx
Created March 18, 2016 20:09
F# Suave Build Script
// --------------------------------------------------------------------------------------
// A simple FAKE build script that:
// 1) Hosts Suave server locally & reloads web part that is defined in 'app.fsx'
// 2) Deploys the web application to Azure web sites when called with 'build deploy'
//
// Source: https://github.com/tpetricek/suave-xplat-gettingstarted/blob/master/build.fsx
// --------------------------------------------------------------------------------------
#r "packages/FSharp.Compiler.Service/lib/net45/FSharp.Compiler.Service.dll"
#r "packages/Suave/lib/net40/Suave.dll"
#r "packages/FAKE/tools/FakeLib.dll"
@mikesigs
mikesigs / LCD.cs
Last active April 22, 2016 19:37
Lowest Common Denominator
void Main()
{
var input = new long[,] { {1, 2}, {1, 3}, {1, 4} };
var fractions =
from i in Enumerable.Range(0, input.GetUpperBound(0) + 1)
select Tuple.Create(input[i,0], input[i,1]);
var denoms = fractions.Select(t => t.Item2).ToArray();
@mikesigs
mikesigs / SQL_Date_Conversions.sql
Created April 26, 2016 17:48
SQL Date Conversions
/* *** SQL Server Date Calculations *** */
-- First day of prior month
SELECT DATEADD(mm, DATEDIFF(mm,0,DATEADD(mm,-1-DATEPART(day,GetDate()),GetDate())),0) /*first day of prior month*/
-- Last month
SELECT CAST(DATEPART(m, GetDate())-1 AS INT) /*last month*/
-- Current year
SELECT CAST(DATEPART(yyyy, GetDate())AS INT) /*current year*/
-- Current day
SELECT CAST(DATEPART(dd, GetDate())AS INT) /*current day*/
-- First day of current year
http://slickdeals.net/forums/showpost.php?p=6480998&postcount=1
Vista Blocked Programs at Startup- Fix Once and for All
I have the VISTA HOME Premium and like the VISTA Basic I do not have Security Policy Control on my non-VISTA Apps. Mad If you have Windows Vista Ultimate then you do. So here is a way too once and for all to fix that VISTA tray BLOCKED APP alert that is quite annoying in that you are alerted with every bootup that your app is blocked and you must allow the app to run each time by giving VISTA permission blessing. Boo on that. So here is the fix:
Remove the startup app that is offending by:
Start----Run----and type in msconfig.exe
Go to STARTUP Tab and remove the app that is blocked by Vista noting on a sheet of paper where the program is run from. If the program app is run from the startup menu, then just go to Start---All Program Files---Startup Folder and remove the app there.