Skip to content

Instantly share code, notes, and snippets.

View joshgo's full-sized avatar
🏠
Working from home

Josh joshgo

🏠
Working from home
View GitHub Profile
@joshgo
joshgo / GIT-CHEATSHEET.txt.md
Last active January 18, 2018 14:47
GITHUB-CHEATSHEET

GIT Cheatsheet

Stage partials/patch

git add --patch

Resolve PR merge conflicts

git fetch origin master
@joshgo
joshgo / datarow-comparer.cs
Last active December 15, 2015 17:09
DataRow Comparer == Solution for sorting rows with your own comparer. Helps with customizing the comparison function. Helps the C# Sort() match the ORDER BY in SQL. http://msmvps.com/blogs/deborahk/archive/2009/07/23/linq-sorting-a-datatable.aspx http://stackoverflow.com/questions/3808158/string-comparison-differences-between-net-and-t-sql
public class RowComparer : IComparer<System.Data.DataRow>
{
public Dictionary<int, bool> SortColumns { get; set; }
public int Compare(System.Data.DataRow x, System.Data.DataRow y)
{
foreach (int key in SortColumns.Keys)
{
int compareResult;
anonymous
anonymous / embedded-resource-for-unit-tests.cs
Created January 16, 2013 16:54
For unit tests that need to load a file. Locating the file is always a problem, instead make it a resource and then call SerializedResource() to write the files to disk. To locate the file just call GetFullname("file1.txt") to get the true name. #nunit #mstest
private string BasePath
{
get
{
return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
}
}
private void SerializeResources()
{