Skip to content

Instantly share code, notes, and snippets.

View mmacaulay's full-sized avatar
💭
Compiling

Matt MacAulay mmacaulay

💭
Compiling
View GitHub Profile
<%= Time.now.to_s(:md) %>
[ui]
username = Matt MacAulay <matt dot macaulay at gmail dot com>
ssh = ssh -C
style = default
logtemplate = '\033[33mchangeset: {rev}:{node|short}\033[0m\nuser: {author}\ndate: {date|isodate}\ntags: {tags}\nmessage:\n\n{desc}\n--------------------------------------------------------------------\n\n'
[extensions]
color =
pager =
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" Matt's vimrc
"" mostly taken from http://amix.dk/vim/vimrc.html
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General
[Test]
public void Should_Accept_Santas_Postal_Code()
{
var result = _canadianPostalCodeAttribute.IsValid("H0H 0H0");
Assert.That(result, Is.True);
}
default_run_options[:pty] = true
set :user, '<username>'
set :domain, '<domain>'
set :project, "<projectname>"
set :application, '<sitename>'
set :applicationdir, "/home/#{user}/#{application}"
set :scm_username, "<username>"
set :repository, "git@github.com:#{scm_username}/#{project}"
protected IDeck deck;
public virtual void Initialise (IDeck deck)
{
deck = deck;
}
@mmacaulay
mmacaulay / IEnumerableExtensionMethods.cs
Created February 8, 2011 01:58
IEnumerable.Each extension method
public static class IEnumerableExtensions
{
public static void Each<T>(this IEnumerable<T> enumerable, Action<T> action)
{
foreach (var item in enumerable)
{
action(item);
}
}
}
@mmacaulay
mmacaulay / custom_matchers.rb
Created November 18, 2011 20:58
RSpec matcher for testing that a hash contains a subset of another hash
# ironic: untested
module CustomMatchers
Spec::Matchers.define :include_hash do |expected|
match do |hash|
expected.keys.each do |key|
return false if !(hash.has_key?(key) && hash[key] == expected[key])
end
end
end
end
@mmacaulay
mmacaulay / gist:6737117
Last active December 24, 2015 03:19
Disk usage of all dotfiles in the current directory
ls -a |grep ^\\..*[^\.]$ | xargs du -s | awk '{ sum += $1 } END { print sum }' | gnumfmt --to=iec
@mmacaulay
mmacaulay / gist:6768417
Created September 30, 2013 18:59
Search and replace in multiple files
find . -type f -print0 | xargs -0 gsed -i 's/thing/other/g'