Skip to content

Instantly share code, notes, and snippets.

@RoryBecker
RoryBecker / gist:6975179
Created October 14, 2013 12:56
How to use CodeRush to create a default implementation of ToString() which emits the names and values of all of the classes properties
How to use CodeRush to create a default implementation of ToString() which emits the names and values of all of the classes properties:
The following 3 sets of data represet CodeRush templates
The first line of each is the name of the template
The following lines (until the row of hyphens) represents the body of the template
Add these 3 templates to be able to Type: "PropertyToString<space>" (no quotes) and have CodeRush generate a default implementation of ToString() which emits the values of each property.
-------------------------------------------------------------
PropertyToString
public override string ToString()
@RoryBecker
RoryBecker / FindDanglingCommits
Created April 22, 2013 08:31
Use this to find dangling commits. ie Commits which still exist but which don't have tags or branches pointing at them. Only works until git's Garbage collection removes them (30 days typically) These can then have tags or branches added to them
gitk --all $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )
@RoryBecker
RoryBecker / Git is a bad idea if...
Created April 17, 2013 17:12
Reasons you probably don't want to use Git as your VCS.
You like the way you have to stop work when your network crumbles around you, because you can't commit.
You like the idea of putting all your eggs in one basket (server)
You like getting exclusive access to files and keeping it so no-one else can do anything useful.
You like paying licence fees for the right to have your own VCS server(s)
You like micro-managing the setup of your existing VCS with 'Extensions' just to get the same functionality as git :D
You don't want easy branching and merging.
You hate the idea that *any* clone of a git repo, could replace a build repo in as much time as it takes to copy that repo.
You hate the idea of a truly fast and flexible VCS
@RoryBecker
RoryBecker / EII.vb
Created May 21, 2012 20:43
Explicit interface implementation
Public Interface ISomeInterface
Sub Method1()
Sub Method2()
Sub Method3()
End Interface
Public MustInherit Class GrandParentExplicit
Implements ISomeInterface
Public Sub Method1() Implements ISomeInterface.Method1
public interface IMyComplete
{
// generated gubbins
void DoWork();
//manual gubbins
void DoWorkImpl();
}
// generated class
@RoryBecker
RoryBecker / gist:2375184
Created April 13, 2012 08:49
Found this comment in my code
' Ok now pay attention because this is already confusing enough.
' Have you already had your coffee?
' No? Well go and get one. You're going to need it...
@RoryBecker
RoryBecker / gist:2292865
Created April 3, 2012 15:18
Git (Pushing and Pulling)
#-------------------------------------------------------------
# Git - Pushing and Pulling
#-------------------------------------------------------------
#fetch all changes from a remote (Does not merge any changes with your local repo)
git fetch <RemoteName>
# Pull specific branch from a named remote
git pull <RemoteName> <Branch>
@RoryBecker
RoryBecker / gist:2292285
Created April 3, 2012 14:09
Git Remotes (Adding and Removeing)
#-------------------------------------------------------------
# Git Remotes (Adding and removing)
#-------------------------------------------------------------
#Add a file share remote
git remote add <remoteName> //MyServer/SomeShare/RestOfPath[.git]
#Add a bitbucket remote
git remote add <remoteName> git@bitbucket.org:[username]/[RepoName].git
@RoryBecker
RoryBecker / gist:2157417
Created March 22, 2012 09:51
NLog Infio vs Other
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="InfoFile" xsi:type="File" fileName="${basedir}/Info.txt" />
<target name="OtherFile" xsi:type="File" fileName="${basedir}/Other.txt" />
</targets>
<rules>
<logger name="*" levels="Info" writeTo="InfoFile" />
@RoryBecker
RoryBecker / gist:1953237
Created March 1, 2012 21:07
git repo creation
#-------------------------------------------------------------
# git repo creation
#-------------------------------------------------------------
#Create new 'empty' repo in the current folder.
git init
#Create new 'empty' repo with no working folder component.
# - Suitable for a central repo model
git init --bare