Skip to content

Instantly share code, notes, and snippets.

Avatar

Benjamin Van Ryseghem BenjaminVanRyseghem

View GitHub Profile
@BenjaminVanRyseghem
BenjaminVanRyseghem / git-prune-branches.sh
Last active May 25, 2016
Script to delete branches that have been merged (and are "gone").
View git-prune-branches.sh
#!/bin/sh
git fetch -p > /dev/null 2>&1
branches=`git branch -vv | grep ': gone]' | awk '{print $1}'`
if [[ -z "$branches" ]]
then
echo "No branch to prune"
exit 0
fi
@BenjaminVanRyseghem
BenjaminVanRyseghem / reviewable-bindings.json
Last active May 23, 2016
My custom bindings for reviewable.io
View reviewable-bindings.json
[
[
"f",
"Show next/latest diffs",
"setProposedRevRanges()"
],
[
"n",
"Next unreviewed file",
"nextUnreviewedFile()"
View parse.py
#!/usr/bin/env python
import parsedatetime
import sys
from time import mktime
from datetime import datetime
AS_DATE_FORMAT = "%d/%m/%y"
string = sys.argv[1]
@BenjaminVanRyseghem
BenjaminVanRyseghem / things.scpt
Last active Aug 29, 2015
Mail -> Things sync
View things.scpt
on theSplit(theString, theDelimiter)
-- save delimiters to restore old settings
set oldDelimiters to AppleScript's text item delimiters
-- set delimiters to delimiter to be used
set AppleScript's text item delimiters to theDelimiter
-- create the array
set theArray to every text item of theString
-- restore the old setting
set AppleScript's text item delimiters to oldDelimiters
-- return the result
@BenjaminVanRyseghem
BenjaminVanRyseghem / drag_n_drop.st
Last active Dec 18, 2016
Drag and Drop Spec Tutorial
View drag_n_drop.st
collection1 := #(1 2 3 4 5) asOrderedCollection.
collection2 := #(a b c d e) asOrderedCollection.
list1 := ListModel new
items: collection1;
yourself.
list2 := ListModel new
items: collection2;
yourself.
@BenjaminVanRyseghem
BenjaminVanRyseghem / custom_list.st
Created Mar 2, 2014
How to make a list render some custom models -- see http://j.mp/1fzQ0HQ
View custom_list.st
items := (1 to: 5) collect: [ :index || model |
model := DynamicComposableModel new
instantiateModels: #(
nameLabel LabelModel
address LabelModel
button ButtonModel ).
model nameLabel label: 'Name'.
model address label: 'Address'.
model button
label: nil;
@BenjaminVanRyseghem
BenjaminVanRyseghem / spec_preference.st
Created Feb 28, 2014
Pharo preference to set git repo to Spec project
View spec_preference.st
StartupAction
name: 'Set git repo'
code: 'MCWorkingCopy allManagers
select: [ :e | e package name beginsWith: ''Spec'' ]
thenDo: [ :e || repository |
repository := MCFileTreeRepository new directory: ''/Users/benjamin/Documents/Benjamin/Spec/spec'' asFileReference.
e repositoryGroup addRepository: repository ]'
runOnce: true.