This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Purpose is to have strongly typed options for in code | |
// and be able to use those options in list operations | |
// as well as have more than two fields. | |
// Usage: | |
// Fruit item = Fruit.GetItems().First(x => x.ID = 1); | |
// Assert.IsTrue(item.Code = "a"); | |
using System.Collections.Generic; | |
using System.Linq; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Function for determining current git branch (if any) | |
# Gracefully fails if not in a git repo and returns nothing. | |
__gitBranch() { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo ${ref#refs/heads/} | |
} | |
# Retrieves status information for git and places into predefined variables. | |
__gitStatus() { | |
# Initialise git status variables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# My preferred prompt for Powershell. | |
# Displays git branch and stats when inside a git repository. | |
# See http://gist.github.com/180853 for gitutils.ps1. | |
. (Resolve-Path ~/Documents/WindowsPowershell/gitutils.ps1) | |
function prompt { | |
$path = "" | |
$pathbits = ([string]$pwd).split("\", [System.StringSplitOptions]::RemoveEmptyEntries) | |
if($pathbits.length -eq 1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Git functions | |
# Mark Embling (http://www.markembling.info/) | |
# Is the current directory a git repository/working copy? | |
function isCurrentDirectoryGitRepository { | |
if ((Test-Path ".git") -eq $TRUE) { | |
return $TRUE | |
} | |
# Test within parent dirs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mklink /D ".\WindowsPowershell" ".\My Dropbox\PowershellProfile" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare @tablename varchar(255) | |
declare @logfilename nvarchar(200) | |
declare @datafilename nvarchar(200) | |
declare @dbname nvarchar(200) | |
declare @sql nvarchar(1000) | |
set @dbname = ltrim(rtrim(db_name())) | |
set @logfilename = ltrim(rtrim((select name from sysfiles where lower(filename) like '%.ldf%'))) | |
set @datafilename = ltrim(rtrim((select name from sysfiles where lower(filename) like '%.mdf%'))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SAVEIFS=$IFS | |
IFS=$(echo -en "\n\b") | |
for f in * | |
do | |
echo "$f" | |
done | |
IFS=$SAVEIFS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %> | |
<% | |
var originalPath = Request.Path; | |
HttpContext.Current.RewritePath(Request.ApplicationPath, false); | |
IHttpHandler httpHandler = new MvcHttpHandler(); | |
httpHandler.ProcessRequest(HttpContext.Current); | |
HttpContext.Current.RewritePath(originalPath, false); | |
%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
email = [email protected] | |
name = Josh King | |
[core] | |
excludesfile = /Users/jking/.gitignore | |
#excludesfile = c:/Users/jking/.gitignore | |
editor = vim | |
pager = less -FRSX | |
[merge] | |
tool = vimdiff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.VisualBasic.FileIO; | |
public class DelmitedFileParser | |
{ | |
private void Parse() | |
{ | |
TextFieldParser parser = new TextFieldParser(@"c:\temp\test.csv"); | |
parser.TextFieldType = FieldType.Delimited; | |
parser.SetDelimiters(","); |