Skip to content

Instantly share code, notes, and snippets.

View tvlooy's full-sized avatar
🐧
<(o)

Tom Van Looy tvlooy

🐧
<(o)
View GitHub Profile
@tvlooy
tvlooy / 01.php
Created June 23, 2011 19:22 — forked from smasty/01.php
10 PHP One Liners to Impress Your Friends
<?
foreach(range(1, 10) as $i) echo $i * 2 . " ";
@tvlooy
tvlooy / image_gallery.html
Created November 24, 2011 10:28
simple jQuery image gallery
[tvl@novo /var/www/html/leeshoek.home.ctors.net/Symfony]
$ app/console behat -e=test
Functionaliteit: Gebruiker moet gebruikers kunnen verwijderen
Om gebruikers te kunnen verwijderen
Met een beheerder
Moet ik een verwijder knop kunnen gebruiken
Scenario: Roep knop op als leerkracht # src/Ctors/ReadingCornerBundle/Features/User/remove.feature:7
Gegeven ik ben ingelogd als "leerkracht" # Ctors\ReadingCornerBundle\Features\Context\ReadingCornerContext::ikBenIngelogdAls()
Als ik naar "/user/1/remove" ga # Ctors\ReadingCornerBundle\Features\Context\ReadingCornerContext::visit()
@tvlooy
tvlooy / BabeRotate.php
Created December 16, 2011 19:48
The babe rotator - V2
<?php
function jpg ($file) { return substr($file, -4) == '.jpg'; }
$imgs = array_filter(scandir('.'), 'jpg');
$max = count($imgs);
shuffle($imgs);
?>
<html>
<body>
<img src="<?php echo $imgs[0]; ?>" id="cur_img" onclick="next();" height="100%" />
<img src="<?php echo $imgs[1]; ?>" id="nxt_img" onclick="next();" style="display: none;" />
@tvlooy
tvlooy / feestdagen.php
Last active March 25, 2024 21:40
Feestdagen berekenen
<?php
// (c) Tom Van Looy <tom@ctors.net> https://ctors.net/isc_license.txt
// Alle feestdagen kunnen berekend worden, de berekende zijn allemaal
// afhankelijk van pasen. PHP heeft een functie easter_date().
// Makkie dus. Hoe easter_date() zelf werkt kan je hier raadplegen:
// https://github.com/php/php-src/blob/master/ext/calendar/easter.c
// Geen parameter? Doen we gewoon dit jaar toch.
@tvlooy
tvlooy / facebook-blocker.sh
Created May 7, 2012 21:54
How to block facebook in a very funny way
#!/bin/bash
while [ TRUE ]; do
detect=$(netstat -an | grep `dig +short www.facebook.com` | grep ESTA | wc -l)
if [ $detect -ne 0 ]; then
osascript -e "set Volume 7"
say -v Zarvox "computer says no, `whoami`"
killall Safari
sleep 10
fi
@tvlooy
tvlooy / rentplus_poc.php
Created May 31, 2012 18:11
Rentplus SOAP proof of concept
<?php
class XmlSerializer {
private static $xmlns = 'www.rentplus.be/webservices/';
public static function toXml($obj) {
$class = get_class($obj);
$xml = '<?xml version="1.0" standalone="yes"?>' .
'<ds' . $class . ' xmlns="' . self::$xmlns . $class . '.xsd">' .
self::serialize($obj) .
@tvlooy
tvlooy / gist:3795348
Created September 27, 2012 17:42
SensioLabsDesktop segfault
[tvl@orion ~]
$ uname -a
Linux orion 3.2.0-31-generic #50-Ubuntu SMP Fri Sep 7 16:16:45 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
[tvl@orion ~]
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.1 LTS
Release: 12.04
#!/bin/bash
if [ ! -f "$1" ]; then
echo "Usage: $0 filename.txt"
exit -1
fi
filename=$1
months="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"
linenr=0
@tvlooy
tvlooy / _phpunit.phar
Created January 26, 2013 20:55
phpunit zsh autocomplete support
#compdef phpunit.phar
_arguments -s -w \
'--list-groups[List available test groups]' \
'--tap[Report test execution progress in TAP format]' \
'--testdox[Report test execution progress in TestDox format]' \
'--colors[Use colors in output]' \
'--stderr[Write to STDERR instead of STDOUT]' \
'--stop-on-error[Stop execution upon first error]' \
'--stop-on-failure[Stop execution upon first error or failure]' \