Skip to content

Instantly share code, notes, and snippets.

View BenjaminVanRyseghem's full-sized avatar

Benjamin Van Ryseghem BenjaminVanRyseghem

View GitHub Profile
@BenjaminVanRyseghem
BenjaminVanRyseghem / spec_preference.st
Created February 28, 2014 09:49
Pharo preference to set git repo to Spec project
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.
@BenjaminVanRyseghem
BenjaminVanRyseghem / custom_list.st
Created March 2, 2014 13:07
How to make a list render some custom models -- see http://j.mp/1fzQ0HQ
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 / drag_n_drop.st
Last active December 18, 2016 17:15
Drag and Drop Spec Tutorial
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 / things.scpt
Last active August 29, 2015 14:15
Mail -> Things sync
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
#!/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 / reviewable-bindings.json
Last active May 23, 2016 11:13
My custom bindings for reviewable.io
[
[
"f",
"Show next/latest diffs",
"setProposedRevRanges()"
],
[
"n",
"Next unreviewed file",
"nextUnreviewedFile()"
@BenjaminVanRyseghem
BenjaminVanRyseghem / git-prune-branches.sh
Last active May 25, 2016 10:04
Script to delete branches that have been merged (and are "gone").
#!/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