Skip to content

Instantly share code, notes, and snippets.

View FlorianWolters's full-sized avatar

Florian Wolters FlorianWolters

View GitHub Profile
@FlorianWolters
FlorianWolters / CleanUpRemovableDisk.cmd
Created February 20, 2012 22:22
Removes the directories "System Volume Information" and "$RECYCLE.BIN" from the drive with the specified drive letter.
@ECHO OFF
REM Removes the directories "System Volume Information" and "$RECYCLE.BIN" from
REM the drive with the specified drive letter.
REM
REM Author: Florian Wolters <[email protected]>
REM Link..: http://github.com/FlorianWolters
REM
REM Copyright (C) 2012 by Florian Wolters. All rights reserved.
REM
REM This program is free software: you can redistribute it and/or modify it
@FlorianWolters
FlorianWolters / lastDayOfCurrentMonth.cmd
Created April 26, 2012 15:37
Prints out the last day of the current month.
@ECHO OFF
REM Prints out the last day of the current month.
REM
REM Author: Florian Wolters <[email protected]>
REM Link..: http://github.com/FlorianWolters
REM
REM Copyright (C) 2012 by Florian Wolters. All rights reserved.
REM
REM This program is free software: you can redistribute it and/or modify it
REM under the terms of the GNU Lesser General Public License as published by the
@FlorianWolters
FlorianWolters / lastDayOfLastMonth.cmd
Created April 27, 2012 14:21
Prints out the last date of the last month in optional DIN 5008 format.
@ECHO OFF
REM Prints out the last date of the last month in optional DIN 5008 format.
REM
REM The optional DIN 5008 format is "dd.mm.yyyy", e.g. "29.02.2012".
REM
REM Author: Florian Wolters <[email protected]>
REM Link..: http://github.com/FlorianWolters
REM
REM Copyright (C) 2012 by Florian Wolters. All rights reserved.
REM
@FlorianWolters
FlorianWolters / Singleton.java
Created May 31, 2012 14:50
Demonstration of the Singleton design pattern in Java.
package de.florianwolters.pattern.singleton;
/**
* Demonstration of the <i>Singleton</i> design pattern in Java.
*
* This is the correct implementation of the <i>Singleton</i> creational design
* pattern in the Java programming language.
*
* - Thread-safe without special language constructs (e.g.
* <tt>synchronized</tt> or <tt>volatile</tt>).
@FlorianWolters
FlorianWolters / apigen.neon
Last active February 21, 2021 03:15
Boilerplate Neon configuration file for the documentation generator "ApiGen".
# apigen.neon
#
# Neon configuration file for the documentation generator "ApiGen".
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
@FlorianWolters
FlorianWolters / Singleton.php
Created September 7, 2012 08:33
Demonstration of the Singleton design pattern in PHP.
<?php
namespace FlorianWolters\Example\Pattern\Design\Creational\Singleton;
/**
* Demonstration of the *Singleton* design pattern in PHP.
*
* This is the correct implementation of the *Singleton* creational design
* pattern in the PHP programming language.
*
* - Prevents cloning of an instance via the `__clone()` magic method.
@FlorianWolters
FlorianWolters / HashCodeTraitImpl.php
Created September 20, 2012 12:12
How NOT to tests PHP 5.4 traits with PHPUnit.
<?php
namespace FlorianWolters\Component\Core;
/**
* A stub class for {@link HashCodeTraitTest} that uses the trait {@link
* HashCodeTrait}.
*
* @author Florian Wolters <[email protected]>
* @copyright 2012 Florian Wolters
* @license http://gnu.org/licenses/lgpl.txt LGPL-3.0+
@FlorianWolters
FlorianWolters / GitCommands.md
Last active October 11, 2015 00:38
Git command line examples

Record changes to the repository.

git commit -a -m "Merged with local develop branch."

Add a tag and push all tags.

git tag -a v0.1.0 -m "version 0.1.0-stable"
git push origin --tags

Remove a remote tag.

@FlorianWolters
FlorianWolters / NotSoImmutableClassExample.php
Last active December 14, 2015 15:29
The class NotSoImmutableClass demonstrates how-to implement the Immutable Object pattern incorrectly.
<?php
namespace FlorianWolters;
/**
* The class {@see NotSoImmutableClass} demonstrates how-to implement the
* *Immutable Object* implementation pattern **incorrectly**
*
* @author Florian Wolters <[email protected]>
* @copyright 2013 Florian Wolters
* @license http://gnu.org/licenses/lgpl.txt LGPL-3.0+
@FlorianWolters
FlorianWolters / FinalKeywordIgnoredInTrait.php
Last active October 24, 2017 17:10
Demonstrates a PHP bug: The "final" keyword for a method is ignored if used in a trait (https://bugs.php.net/bug.php?id=62204)
<?php
/**
* FinalKeywordIgnoredInTrait.php
*
* PHP 5.4.13 (cli) (built: Mar 15 2013 02:05:59)
* Copyright (c) 1997-2013 The PHP Group
* Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
* with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans
*
* @link https://bugs.php.net/bug.php?id=62204