Skip to content

Instantly share code, notes, and snippets.

View chrisortman's full-sized avatar

Chris Ortman chrisortman

View GitHub Profile
@chrisortman
chrisortman / gist:828404
Created February 15, 2011 22:30
Razor view with weird rule
@model InnovativeSystems.OSS.OrderClient.Modules.Order.Web.EditRatePlanModel
@{
ViewBag.Title = "Edit";
}
<script>
$(document).ready(function () {
$('.rate-plan-attributes input:text').editMaskValidate();
});
</script>
@chrisortman
chrisortman / gist:844540
Created February 25, 2011 21:33
Why cant i have guid primary keys entity framework :(
if (entitySet.ElementType.KeyMembers.Count > 0)
{
builder.Append(" PRIMARY KEY (");
bool flag = true;
foreach (EdmMember member in entitySet.ElementType.KeyMembers)
{
if (IsServerGeneratedGuid(member))
{
throw ADP1.ServerGeneratedGuidKeyNotSupportedException(member.Name);
}
param($packageName)
write-host "Testing $packageName"
$chocPath = "c:\nuget"
$binFile = "c:\nuget\bin\$packageName.bat"
if(test-path $binFile) {
Write-host "Removing $binFile"
Remove-Item $binFile
@chrisortman
chrisortman / gist:994090
Created May 26, 2011 21:10
First stab at powershell function to check if project has a package
function Test-Project {
param(
#The package we are looking for
$PackageName
)
Process {
$hasPackage = $false
$packages = get-package $PackageName -First 1
foreach ($package in $packages) {
@chrisortman
chrisortman / gist:1092889
Created July 19, 2011 15:58
Configure rolling file logging for nlog
SimpleConfigurator.ConfigureForTargetLogging(
new NLog.Targets.FileTarget()
{
FileName = "${specialfolder:MyDocuments}/logs/" + filename + ".${shortdate}.txt",
Layout = new NLog.Layouts.SimpleLayout("${longdate} [${level:uppercase=true}] [${threadid}] ${callsite} - ${message}"),
ArchiveFileName = "${specialfolder:MyDocuments}/logs/archived/" + filename + ".{#####}.txt",
ArchiveAboveSize = 10000000 /* 10 MB */,
ArchiveNumbering = ArchiveNumberingMode.Sequence,
ConcurrentWrites = true,
KeepFileOpen = false,
@chrisortman
chrisortman / gist:1123807
Created August 3, 2011 21:25
vim script to remove webforms tags and replace with razor
function! DumpWebforms()
%s/<% \([^}]\)/@\1
%s/<%= /@
%s/<%=/@
%s/<%//
%s/%>//
endfunction
@chrisortman
chrisortman / gist:1635993
Created January 18, 2012 21:50
MSBuild output when EntityFramework installed in GAC
Primary reference "EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". (TaskId:16961)
Resolved file path is "C:\Builds\10\OSS\Current\Sources\Current\Billing\Web\packages\EntityFramework.4.1.10715.0\lib\EntityFramework.dll". (TaskId:16961)
Reference found at search path location "{HintPathFromItem}". (TaskId:16961)
For SearchPath "C:\Builds\10\OSS\Current\Sources\Current\_Dependencies". (TaskId:16961)
Considered "C:\Builds\10\OSS\Current\Sources\Current\_Dependencies\EntityFramework.dll", but it didn't exist. (TaskId:16961)
Considered "C:\Builds\10\OSS\Current\Sources\Current\_Dependencies\EntityFramework.exe", but it didn't exist. (TaskId:16961)
For SearchPath "C:\Builds\10\OSS\Current\Sources\Current\_GAC Dependencies". (TaskId:16961)
Considered "C:\Builds\10\OSS\Current\Sources\Current\_GAC Dependencies\EntityFramework.dll", but it didn't exist. (TaskId:16961)
Considered "C:\Builds\10\OSS\Current\Sour
@chrisortman
chrisortman / project file
Created February 23, 2012 17:27
Project file diff upgrading mvc3 to mvc4 beta
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Extensions" />
- <Reference Include="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\AspMvc-3.0\System.Web.Helpers.dll</HintPath>
- <Private>False</Private>
+ <Reference Include="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">^M
+ <Private>True</Private>^M
+ <HintPath>..\..\packages\AspNetWebPages.Core.2.0.20126.16343\lib\net40\System.Web.Helpers.dll</HintPath>^M
@chrisortman
chrisortman / A.cs
Created February 27, 2012 22:11
IoC example
public class A {
public A() {
_b = new B();
}
}
@chrisortman
chrisortman / ImportedFilePathResolver.cs
Created March 8, 2012 19:48
ASP.NET Optimization Minifiers
public class ImportedFilePathResolver : IPathResolver
{
private string currentFileDirectory;
private string currentFilePath;
/// <summary>
/// Initializes a new instance of the <see cref="ImportedFilePathResolver"/> class.
/// </summary>
/// <param name="currentFilePath">The path to the currently processed file.</param>
public ImportedFilePathResolver(string currentFilePath)