Skip to content

Instantly share code, notes, and snippets.

View maul-esel's full-sized avatar

maul.esel maul-esel

View GitHub Profile
@maul-esel
maul-esel / example.liquid
Last active December 23, 2015 14:59
a WIP pygments lexer for the liquid templating language
# This is an example file. Process it with `./pygmentize -O full -f html -o /liquid-example.html example.liquid`.
{% raw %}
some {{raw}} liquid syntax
{% raw %}
{% endraw %}
Just regular text - what happens?
@maul-esel
maul-esel / games.html
Last active December 17, 2015 11:29
"TicTacToe" and "Connect 4" implemented with CoffeeScript - designed to be easily extendable.
<!DOCTYPE html>
<html>
<head>
<title>Games</title>
<meta charset='utf-8'/>
<script type='text/javascript' src='coffee-script.js'></script>
<script type='text/coffeescript' src='lib.coffee'></script>
<link rel='stylesheet' type='text/css' href='style.css'/>
</head>
<body>
@maul-esel
maul-esel / API-Test.php
Last active December 14, 2015 17:39
A PHP page for testing web APIs, particularly for libba.net.
<?php
if (!empty($_POST)) {
$conn = curl_init();
switch ($_POST['method']) {
case 'GET': $method = CURLOPT_HTTPGET;
break;
case 'POST': $method = CURLOPT_POST;
break;
case 'PUT': $method = CURLOPT_PUT;
@maul-esel
maul-esel / HttpException.php
Last active December 12, 2015 03:48
A small class used in some of my projects for handling or throwing HTTP errors.
<?php
class HttpException extends Exception
{
private $headers;
public function __construct($code, $message = NULL, $headers = NULL)
{
$this->code = $code;
$this->headers = $headers;
parent::__construct(self::getStatusMessage($code) . ($message ? '<p>' . $message . '</p>' : ''), $code);
@maul-esel
maul-esel / AHK-versions.svg
Created January 3, 2013 16:21
An SVG image illustrating the development of the different AutoHotkey branches
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maul-esel
maul-esel / CustomSingleInstance.ahk
Created November 18, 2012 14:59
A custom implementation of a SingleInstance script (e.g. for custom messages to be displayed)
#NoEnv
#SingleInstance off ; sonst kriegen wir (zumindest bei kurzen Skripten) die AHK-Meldung
/*
registriere Nachrichten
===========================
Wir könnten hier irgendwelche festen Zahlen verwenden, aber wenn wir Pech haben, führt das zu Konflikten mit anderen Programmen,
die dieselbe Zahl für was Anderes nutzen.
Also registrieren wir die Nachricht offiziell bei Windows und kriegen den Zahlenwert dafür geliefert.
*/
@maul-esel
maul-esel / GetFont.ahk
Created October 4, 2012 17:11
A function to retrieve the font used by a control (if the control supports WM_GETFONT)
GetFont(hwnd, byRef font, byRef options)
{
static WM_GETFONT := 0x0031
, HWND_DESKTOP := 0
, HDC_DESKTOP := 0
, sizeof_LOGFONT := 28 + 32 * (A_IsUnicode ? 2 : 1)
, LOGPIXELSY := 90
SendMessage WM_GETFONT, 0, 0,, ahk_id %hwnd%
if (!ErrorLevel || ErrorLevel = "FAIL")
@maul-esel
maul-esel / ClientToWindow.ahk
Created October 3, 2012 21:23
a function to convert client-area-relative cooordinates to window-relative coordinates
ClientToWindow(hwnd, byRef x, byRef y)
{
VarSetCapacity(pt, 8, 0)
, NumPut(x, pt, 0, "UInt")
, NumPut(y, pt, 4, "UInt")
if (!DllCall("ClientToScreen", "Ptr", hwnd, "Ptr", &pt, "UInt"))
return false
VarSetCapacity(rc, 16, 0)
/*
Title: LVX Library
Row colouring and cell editing functions for ListView controls.
Remarks:
Cell editing code adapted from Michas <http://www.autohotkey.com/forum/viewtopic.php?t=19929>;
row colouring by evl <http://www.autohotkey.com/forum/viewtopic.php?t=9266>.
Many thanks to them for providing the code base of these functions!
@maul-esel
maul-esel / semver.php
Last active October 6, 2015 09:48
semver PHP lib
<?php
function semver_validate($version)
{
return !!preg_match('/^(\d+)\.(\d+)\.(\d+)(\-([0-9A-Za-z\-]+\.)*[0-9A-Za-z\-]+)?(\+([0-9A-Za-z\-]+\.)*[0-9A-Za-z\-]+)?$/', $version);
}
function semver_parts($version, &$parts)
{
return !!preg_match('/^(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<prerelease>([0-9A-Za-z\-]+\.)*[0-9A-Za-z\-]+))?(\+(?P<build>([0-9A-Za-z\-]+\.)*[0-9A-Za-z\-]+))?$/', $version, $parts);
}
function semver_compare($version1, $version2)