Skip to content

Instantly share code, notes, and snippets.

View clauswitt's full-sized avatar

Claus Witt clauswitt

View GitHub Profile
@clauswitt
clauswitt / AgoViewHelper.php
Created November 15, 2011 13:48
A simple "how long ago" viewhelper for Flow3
<?php
namespace ClausWitt\ViewHelpers;
/**
* A view helper for getting a specific date as "how along ago"
*
*
*/
class AgoViewHelper extends \TYPO3\Fluid\Core\ViewHelper\AbstractViewHelper {
/**
@clauswitt
clauswitt / UnitTests.xml
Created November 24, 2011 07:27
A per package unit test configuration for FLOW3
<?xml version="1.0"?>
<phpunit strict="true"
bootstrap="UnitTestBootstrap.php"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true">
<testsuites>
<testsuite name="All tests">
<directory>../../Tests/Unit</directory>
</testsuite>
@clauswitt
clauswitt / UnitTestBootstrap.php
Created November 24, 2011 07:28
A per package unit test bootstrap file for unit testing packages in FLOW3
<?php
namespace TYPO3\FLOW3\Build;
/* *
* This script belongs to the FLOW3 build system. *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License as published by the Free *
* Software Foundation, either version 3 of the License, or (at your *
* option) any later version. *
@clauswitt
clauswitt / index.html
Created November 24, 2011 13:25 — forked from getify/index.html
showing how i use $LAB in my pages -- aka, best-practice recommendation
<!DOCTYPE html>
<html>
<head>...</head>
<body>
...
<script src="load.js"></script>
</body>
</html>
@clauswitt
clauswitt / new.rb
Created January 7, 2012 09:45 — forked from minhajuddin/new.rb
#!/usr/bin/env ruby
# Script to create a jekyll blog post using a template and open it in textmate. It takes one input parameter
# which is the title of the blog post
# e.g. command:
# $ ./new.rb "helper script to create new posts using jekyll"
#
# Author:Khaja Minhajuddin (http://minhajuddin.com)
# Minor tweaks by Claus Witt (http://www.clauswitt.com)
@clauswitt
clauswitt / blogposts.plugin.zsh
Created January 7, 2012 10:25
Two small zsh functions I use for creating (and deploying) blogposts
blog() { cd ~/Documents/Projects/clauswitt.com; ./new.rb $1 ; }
bloglive() { cd ~/Documents/Projects/clauswitt.com; ./deploy.sh }
@clauswitt
clauswitt / cw.plugin.zsh
Created January 9, 2012 12:54
Zsh function to git add last parameter of last command
alias c='git commit '
alias gd='git diff '
gal() {
last_command=$history[$[HISTCMD-1]];
last_command_array=("${(s/ /)last_command}")
echo $last_command_array[-1];
git add $last_command_array[-1];
}
@clauswitt
clauswitt / distance.js
Created January 13, 2012 07:11
Get the distance between two (world) coordinates - a nodejs module
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* */
/* Simple node js module to get distance between two coordinates. */
/* */
/* Code transformed from Chris Veness example code - please refer to his website for licensing */
/* questions. */
/* */
/* */
/* Latitude/longitude spherical geodesy formulae & scripts (c) Chris Veness 2002-2011 */
/* - www.movable-type.co.uk/scripts/latlong.html */
@clauswitt
clauswitt / rename.sh
Created January 22, 2012 21:04
Remove prefix with 5 digits and an underscore from 1800+ filenames
#! /bin/bash
for i in *
do
mv $i `echo $i | sed 's/[0-9]\{5\}_\(.*\)/\1/'`
done
@clauswitt
clauswitt / removeUnusedTrackingBranches.sh
Created January 23, 2012 09:25
Remove unused tracking branches
#!/bin/bash
TMPFILE=".tmpGitRemotes"
REMOTENAME="origin"
COMMIT=$1
git fetch
git branch -a --merged |grep "remotes/$REMOTENAME/" > $TMPFILE
if [[ $COMMIT == "commit" ]]; then
echo "deleting git branches"
else