Skip to content

Instantly share code, notes, and snippets.

@mmichaelis
mmichaelis / Convert-SVG-To-Icon
Created August 31, 2019 14:17
ImageMagick Commands
mogrify -format ico -density 600 -define "icon:auto-resize" -transparent white *.svg
@mmichaelis
mmichaelis / .git-add-worktree.ps1
Last active April 30, 2018 17:25
Creates a git working tree following some conventions.
@('feature-1', 'bug-2') | % {
git worktree add -b $_ "$(git rev-parse --show-toplevel)\..\$_" "origin/$_"
}
@mmichaelis
mmichaelis / .git-delete-working.tree.ps1
Last active April 13, 2018 05:33
Deletes a git working tree as sibling to your current workspace.
@('feature-1', 'bug-2') |
%{ $pattern = $_; $(
git worktree list | %{ $_.Split()[0] } | Select-String $pattern
)
} |
%{ Remove-Item -Recurse -Force $_ }; git worktree prune
@mmichaelis
mmichaelis / .git-prune-orphaned-tracking-branches.ps1
Last active April 3, 2019 08:44
Based on Erik Aybar's 'Git Tip: Deleting Old Local Branches', this snippet will delete all local branches which are tracking remote branches which are gone meanwhile, for example because they already got merged.
git branch -vv|select-string "\[origin/(.*): gone\]"|%{$_.matches.groups[1].value}|%{git branch -D $_}
@mmichaelis
mmichaelis / bash_script_template.sh
Last active February 13, 2017 13:56
Template with some convenience settings for bash scripts.
#!/usr/bin/env bash
set -o nounset
set -o pipefail
set -o errexit
### Uncomment to enable debugging
#set -o verbose
#set -o xtrace
declare -r BOLD="$(tput bold)"
@mmichaelis
mmichaelis / BadStory.story
Created November 25, 2011 08:21
BDD: Stories which really matter
Scenario: Edit String Property Field
!--
Given I am logged in
When I create document A of type Article
And I enter some text T into property Title
Then the preview will update to contain text T
@mmichaelis
mmichaelis / AbstractReferenceTracker.java
Created November 22, 2011 10:48
BDD Design Pattern: Reference Tracker
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/**
* <p>
* Tracks references between BDD steps. Typically you need some global variables or something alike to remember
@mmichaelis
mmichaelis / RomanNumberTest.java
Created November 10, 2011 22:50
Coding Kata: Roman Numerals DDT JUnit Test
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.List;
import static java.util.Arrays.asList;
import static org.junit.Assert.assertEquals;
@RunWith(Parameterized.class)
@mmichaelis
mmichaelis / AmbiguousSteps.java
Created November 8, 2011 13:55
BDD: Ambiguous Step Definitions
@When("I log in as user $user with password $password")
public void login1(String user, String password) {
...
}
[...]
@When("I log in as user named $user with password $password")
public void login2(String user, String password) {
...
}
@mmichaelis
mmichaelis / FullstopStory.java
Created November 7, 2011 18:29
BDD: Given, When, Then - Emergency Break (Related to http://jira.codehaus.org/browse/JBEHAVE-615)
@Then("the delete button will be enabled")
public void deleteButtonEnabled() {
// ...
}