Skip to content

Instantly share code, notes, and snippets.

View bverbeken's full-sized avatar

Ben Verbeken bverbeken

View GitHub Profile
@bverbeken
bverbeken / usePlay.sh
Created January 14, 2012 14:55
script to easily switch between Playframework versions
#!/bin/bash
BASE_PATH="$HOME/Development/tools/playframework"
changePath () {
path_remove $1;
export PATH="$1:$PATH";
}
path_remove () {
@bverbeken
bverbeken / AfterOrganisationTest.java
Created October 19, 2012 11:31
Custom JUnit runner for Playframework (2.0) apps to eliminate boilerplate code
@RunWith(PlayJUnitRunner.class)
public class AfterOrganisationTest {
@Test
public void canBePersisted() {
new Organisation("org1").save();
Organisation reloadedOrg = Ebean.find(Organisation.class).findUnique();
assertThat(reloadedOrg.name).isEqualTo("org1");
}
@bverbeken
bverbeken / loadLibs.js
Created April 18, 2013 15:11
Poor man's requirejs
; (function($, Raphael, window, document, undefined){
function loadLibs(libs, callback) {
function loadScripts(callback) {
libs.forEach(function(lib){
if (!lib.getLib()){
console.log("loading " + lib.url);
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
@bverbeken
bverbeken / .gitconfig
Created May 8, 2013 10:53
~/.gitconfig: crlf & aliases
[core]
autocrlf = input
safecrlf = true
[alias]
co = checkout
ci = commit
st = status
br = branch
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
histall =log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short --all
<script type="text/javascript" src="http://seats.io/plan.js"></script>
<script type="text/javascript">
plan = {
// configure plan properties here
}
</script>
@bverbeken
bverbeken / AddressBuilder.java
Last active August 12, 2020 10:23
Builder pattern for test fixtures
public class AddressBuilder {
public static AddressBuilder anAddress(){
return new AddressBuilder();
}
@Override
public Address build() {
Address address = new Address();
// ... set fields, you get the idea
@bverbeken
bverbeken / gist:5908972
Created July 2, 2013 12:44
eclipse-like keybindings for sublime 2
[
{ "keys": ["shift+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line.sublime-macro"} },
{ "keys": ["alt+up"], "command": "swap_line_up" },
{ "keys": ["alt+down"], "command": "swap_line_down" },
{ "keys": ["ctrl+alt+j"], "command": "join_lines" },
{ "keys": ["ctrl+alt+down"], "command": "duplicate_line" },
{ "keys": ["shift+ctrl+r"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} },
{ "keys": ["ctrl+shift+s"], "command": "save_all" },
{ "keys": ["ctrl+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} },
{ "keys": ["shift+ctrl+f4"], "command": "close_all" },
@bverbeken
bverbeken / gist:6230172
Created August 14, 2013 11:24
.bash_aliases
alias q='exit'
alias cd..='cd ..'
alias top='htop'
alias ports='netstat -tulanp'
alias ll='ls -hal'
@bverbeken
bverbeken / application.js
Created November 29, 2013 11:00
WnotW pricing table fix
$('#pricingModal').click(function(e){
e.preventDefault();
var scroll = $(window).scrollTop();
$('#modalBackdrop, #modalPrice').show();
$('#modalPrice').css({
position: 'absolute', // This is missing
@bverbeken
bverbeken / app.js
Last active July 22, 2018 13:37
angular, spring MVC and multipart/form-data
$scope.saveMyObject = function () {
return $http({
method: 'POST',
url: '/my/url',
headers: {
'Content-Type': undefined // --> makes sure the boundary is set in the Content-Type header, see result file
},
data: {
file: $scope.file,
startDate: $scope.startDate,