Skip to content

Instantly share code, notes, and snippets.

@hanson-andrew
hanson-andrew / gist:7266770
Created November 1, 2013 15:03
My attempt at Roy Osherove's TDD Kata 1 ended up with this skeleton
public class Math
{
private _parser As IParser;
public Math(IParser parser)
{
this._parser = parser;
}
@hanson-andrew
hanson-andrew / about.md
Last active December 17, 2015 17:19 — forked from jasonrudolph/about.md
@hanson-andrew
hanson-andrew / gist:5511098
Created May 3, 2013 16:49
My implementation of an expression to property name converter. I use it to pull property names in a type-safe way. Usage: public void WhatProperty<T>(Expression<Func<T,object>> expr) { string name = GetPropertyName(expr); }
string GetPropertyName(Expression e)
{
var lambdaExpression = e as LambdaExpression;
if (lambdaExpression != null)
{
return GetPropertyName(lambdaExpression.Body);
}
var unaryExpression = e as UnaryExpression;
if (unaryExpression != null)
@hanson-andrew
hanson-andrew / new_gist_file
Created March 25, 2013 13:10
Pl/SQL snippet to search for text inside compiled procedures/functions. Courtesy of: http://stackoverflow.com/questions/853547/sql-to-search-objects-including-stored-procedures-in-oracle
SELECT owner, name, type, line, text
FROM dba_source
WHERE instr(UPPER(text), UPPER(:srch_str)) > 0;
@hanson-andrew
hanson-andrew / gist:4950084
Created February 14, 2013 02:01
Powershell line ending normalizer
Get-ChildItem * -Recurse -Include *.php,*.css,*.js | ForEach-Object {
$wholeFile = [IO.File]::ReadAllText( $_.FullName )
if ($wholeFile -match "`r[^`n]")
{
$content = Get-Content $_.FullName
$content | Set-Content $_.FullName
}
}