Skip to content

Instantly share code, notes, and snippets.

@davidalpert
davidalpert / rake.out
Created February 26, 2011 03:10
results of running 'rake' on my current net40 branch
------ Test started: Assembly: Machine.UrlStrong.Specs.dll ------
when generating
» should look right (FAIL)
UrlNode, when creating a UrlNode with parameters
» should have a format string with parameters
UrlNode, when creating a UrlNode with a dash
» should have ClassName with underscore
@davidalpert
davidalpert / install-packages.ps1
Created April 17, 2011 05:45
Powershell one-liner loops recursively tghrough the current folder calling 'nuget install' on each packages.config under the current location.
Get-ChildItem . -Recurse -Filter packages.config | ForEach ($_) {$configPath = $_.FullName;Write-Host;Write-Host "Reading $configPath"; nuget install $configPath -OutputDirectory .\packages}
@davidalpert
davidalpert / kickstart_minimal
Created April 28, 2011 03:31
use rake to kickstart IIS Express
task :kickstart_iisexpress do
# this task is a workaround for the following issue: http://stackoverflow.com/questions/4605750/iis-express-from-command-line
path_to_iisExpress = File.join(tools_path, 'IIS Express', 'iisexpress.exe')
output = IO.popen(path_to_iisExpress) do |pipe|
sleep 3 #seconds
Process.kill("KILL", pipe.pid)
pipe.close
def svn_version
version_range = `./tools/svn/svnversion`.match('(\d+)(?::(\d+))?') rescue [-1]
ENV["BUILD_VCS_NUMBER"] || version_range[2] || version_range[1]
end
@davidalpert
davidalpert / Rakefile.rb
Created May 7, 2011 16:27 — forked from amirci/Rakefile.rb
Rakefile to generate nuget packages passing the name of the package, version and folder to get the assemblies from
require 'rubygems'
require 'rake/clean'
require 'albacore'
include FileUtils
desc 'Publish nuget package'
task :default => ["deploy:publish"]
namespace :deploy do
@davidalpert
davidalpert / HyperLinkTagHelpers.cs
Created May 11, 2011 05:27
HyperLink helpers that depend on FubuMVC's HtmlTags spinoff library
public static class HyperLinkTagHelpers
{
public static HtmlTag HyperLink( this HtmlHelper htmlHelper, string linkText, IUrl url )
{
return htmlHelper.HyperLink( linkText, url, null );
}
public static HtmlTag HyperLink( this HtmlHelper htmlHelper, string linkText, IUrl url, object htmlAttributes )
{
return htmlHelper.HyperLink( linkText, url.ToString(), new RouteValueDictionary( htmlAttributes ) );
Configure.TypesToScan.Where(t => typeof(INeedToInstallSomething).IsAssignableFrom(t))
.ToList().ForEach(t => config.Configurer.ConfigureComponent(t, DependencyLifecycle.InstancePerCall));
Configure.TypesToScan.Where(t => typeof(INeedToInstallSomething).IsAssignableFrom(t) && t.IsInterface == false)
.ToList().ForEach(t => config.Configurer.ConfigureComponent(t, DependencyLifecycle.InstancePerCall));
@davidalpert
davidalpert / IKeyEventArgs.cs
Created June 23, 2011 15:08
Abstracting WPF's KeyEventArgs
/// <summary>
/// Extracts the interesting parts of a <see cref="KeyEventArgs"/> so that we can mock it outside of the WPF runtime in a test.
/// </summary>
public interface IKeyEventArgs
{
bool Handled { get; set; }
object OriginalSource { get; }
Key DeadCharProcessedKey { get; }
Key ImeProcessedKey { get; }
bool IsDown { get; }
@davidalpert
davidalpert / ITextCompositionEventArgs.cs
Created June 23, 2011 15:12
Abstracting WPF's TextCompositionEventArgs
public interface ITextCompositionEventArgs
{
string Text { get; }
bool Handled { get; set; }
}