Skip to content

Instantly share code, notes, and snippets.

View rubberduck203's full-sized avatar

Christopher McClellan rubberduck203

View GitHub Profile
@rubberduck203
rubberduck203 / RubberduckRomanNumeralTests
Last active August 29, 2015 14:13
Rubberduck Unit Tests for Roman Numeral Kata
Option Explicit
Option Private Module
' Unit Tests for the Roman Numeral Kata (Part I)
' http://codingdojo.org/cgi-bin/index.pl?KataRomanNumerals
' Uses the Rubberduck VBE Add-in Unit Testing framework
' https://github.com/retailcoder/Rubberduck
@rubberduck203
rubberduck203 / MockVBEReferences
Last active August 29, 2015 14:23
Mock a plain Enumerable with Moq that also works with Linq
[TestMethod]
public void PlainEnumerableExample()
{
var project = new Mock<VBProject>();
var refs = new Mock<References>();
refs.Setup(r => r.GetEnumerator()).Returns(ReferenceList());
refs.As<IEnumerable>().Setup(r => r.GetEnumerator()).Returns(ReferenceList);
project.SetupGet(p => p.References).Returns(refs.Object);
acfb2780-16e9-11e5-940a-9b1d9e151603 … 2015-06-19 21:14:19
Completed in 4.91 seconds. Redeliver
Request Response 500
Headers
Request URL: http://stats.zomis.net/GithubHookSEChatService/hooks/github/payload?roomId=14929
Request method: POST
content-type: application/json
Expect:
User-Agent: GitHub-Hookshot/2df80d7
X-GitHub-Delivery: acfb2780-16e9-11e5-940a-9b1d9e151603
describe('when successful', () => {
it('should return all items', () => {
return todo.findAll(request, response)
.then(() => {
var actual = response._getData();
expect(actual).to.deep.equal(testData);
}).catch((err) => {
throw err
});
});
@rubberduck203
rubberduck203 / gitHistory.sh
Created July 6, 2017 12:18
List Files Changed Per Commit
# Provides a list of files changed per commit
# I'm looking to improve on this to get a usable dataset to analyze file change frequency and frequency of files changed in unison over time.
# I'd like to cross reference this with a static code analysis to look for hot spots in a code base.
git log --pretty=format:"%h" | xargs git show --stat --oneline
@rubberduck203
rubberduck203 / .gitconfig
Last active May 16, 2022 19:02
Git Aliases
[alias]
fuckit = reset HEAD
update = commit --amend --no-edit
fix = !git add -A && git commit --amend --no-edit
lg = log --color --graph --abbrev-commit --pretty=oneline
rstat = !git fetch && git status
# del-merged = !git branch --merged master | grep -v "master" | xargs git branch -d
# refresh = !git fetch -p && git pull && git del-merged
# wrap in an "anonymous" function so we can pass arguments
# this makes it easier to work with repos where the trunk is named `main`
root@a9b8ec9a8ca9:~# dotnet bin/gitnstats/gitnstats.dll Rubberduck/ | head -103
Repository: Rubberduck/
Branch: next
Commits Path
1754 RetailCoder.VBE/Rubberduck.csproj
983 RetailCoder.VBE/UI/RubberduckUI.resx
965 RetailCoder.VBE/UI/RubberduckUI.Designer.cs
833 RetailCoder.VBE/App.cs
761 Rubberduck.Parsing/VBA/RubberduckParserState.cs
@rubberduck203
rubberduck203 / PutzingWithMonads.cs
Last active August 6, 2017 03:22
Putzing with monads
public class Class1
{
[Fact]
public void applesauce()
{
Result<int> result =
new Success<int>(32)
.Bind(i => new Success<int>(i + 1));
result.OnSuccess(Console.WriteLine);
def map = { collection, f ->
def result = []
collection.each { element ->
result.add(f(element))
}
result
}
def reduce = { collection, accumulator, f ->
def result = accumulator
#Summarize size of the contents of directories under current directory and sort
# get summarized human readable sizes | sort human readable numbers
du -sh ./* | sort -h
# total disk free per partition
df -h