Skip to content

Instantly share code, notes, and snippets.

Avatar

Bouke Haarsma Bouke

View GitHub Profile
@Bouke
Bouke / Batch-import-into-GitHub-from-flyspray.php
Created May 4, 2010
import issues from flyspray into github
View Batch-import-into-GitHub-from-flyspray.php
<?php
/**
* Example database from flyspray
*
* @author Bouke Haarsma <bouke@webatoom.nl>
*/
mysql_connect("localhost", "(user)", "(pass)");
mysql_select_db("(db)");
View snippet-singleton.php
class ${ClassName} {
protected static $instance;
/**
* Returns an instance of this Singleton
* @return ${ClassName}
*/
public static function getInstance() {
if(!isset(self::$instance)) {
self::$instance = new self();
@Bouke
Bouke / .bashrc
Created Nov 2, 2010
git branch styled in prompt
View .bashrc
# if GIT_PS1_SHOWDIRTYSTATE is set to a nonempty value,
# unstaged (*) and staged (+) changes will be shown next to the branch name
export GIT_PS1_SHOWDIRTYSTATE=1
# if GIT_PS1_SHOWSTASHSTATE is set to a nonempty value,
# a ‘$’ will be shown next to the branch name if something is stashed
export GIT_PS1_SHOWSTASHSTATE=1
# if GIT_PS1_SHOWUNTRACKEDFILES is set to a nonempty value,
# a ‘%’ will be shown next to the branch name if there’re untracked files
@Bouke
Bouke / fabfile.py
Created Sep 16, 2012
fabric test: hosts/roles command line overrides
View fabfile.py
from fabric.api import *
## hosts
@task
@hosts('a')
def first():
execute(second)
@task
@Bouke
Bouke / gist:4059634
Created Nov 12, 2012
OSX: wx, Grid, ChoiceEditor and empty cell -> render issue
View gist:4059634
import wx
import wx.grid
class Frame1(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, id=-1, name='', parent=None,
pos=wx.Point(100, 100), size=wx.Size(480, 250),
style=wx.DEFAULT_FRAME_STYLE, title='Spam & Eggs')
self.SetClientSize(wx.Size(400, 250))
@Bouke
Bouke / gist:4110867
Created Nov 19, 2012
OSX-like toolbar wxpython
View gist:4110867
import wx
class DemoFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, wx.ID_ANY, "Somewhat Native OSX Toolbar", size=(700,400))
self.toolbar = self.CreateToolBar(wx.TB_FLAT | wx.TB_TEXT)
self.toolbar.AddLabelTool(wx.ID_NEW, 'Label', wx.Bitmap('wrench.png'))
self.toolbar.AddCheckLabelTool(wx.ID_NEW, 'Check', wx.Bitmap('wrench.png'))
self.toolbar.AddRadioLabelTool(wx.ID_NEW, 'Radio 1', wx.Bitmap('wrench.png'))
View fb.achievement.html
<html>
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# je-eigen-ronde: http://ogp.me/ns/fb/je-eigen-ronde#">
<title>OG Sample Object - Sample Track</title>
<meta property="og:type" content="game.achievement" />
<meta property="og:title" content="Completed All Tracks!" />
<meta property="fb:app_id" content="121286284698132" />
<meta property="og:image" content="https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png" />
<meta property="og:url" content="https://gist.github.com/raw/4446602/fb.achievement.html" />
<meta property="og:description" content="Marvelous achievement" />
<meta property="game:points" content="50" />
@Bouke
Bouke / gist:5150181
Last active Dec 14, 2015
Random Password Generator Bookmarklet
View gist:5150181
javascript:(function() {
tmp = "";
for (var i=0; i<24; i++) {
tmp += String.fromCharCode((Math.random() * 94 | 0) + 33);
}
prompt("Your password", tmp);
})()
@Bouke
Bouke / gist:5187280
Created Mar 18, 2013
run all tests on pre-push
View gist:5187280
remote="$1"
url="$2"
while read local_ref local_sha remote_ref remote_sha
do
if [ "$remote_ref" == "refs/heads/master" ]; then
# echo "Pushing to refs/heads/master, running test cases"
if [ "$local_ref" == "HEAD" ]; then
[virtualenv's]python manage.py test --failfast
exit $?
You can’t perform that action at this time.