Skip to content

Instantly share code, notes, and snippets.

View delphidabbler's full-sized avatar

Peter Johnson delphidabbler

View GitHub Profile
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
@delphidabbler
delphidabbler / SF Blog RSS Bug Workaround.php
Last active October 12, 2015 09:33
Work-around for bug in SourceForge blog RSS feeds. This code reads the SF feed, transforms it to fix the bug and emits the revised code as a fresh XML document. Fully described at http://delphidabbler.blogspot.co.uk/2014/02/ive-just-been-setting-up-new-blog-for.html
<?php
/*
Fix for SF RSS feed bug: https://sourceforge.net/p/allura/tickets/6687/
Reads RSS source code from SourceForge and re-renders it, adding an
isPermaLink=false attribute to every <guid> tag.
*/
mb_internal_encoding('UTF-8');
mb_http_output('UTF-8');
mb_language('uni');
@delphidabbler
delphidabbler / UBox.pas
Created April 7, 2014 00:10
A generic Delphi class that can wrap any type in an object. Designed for use in wrapping value types and strings in objects. Extracted from my CodeSnip project (http://codesnip.delphidabbler.com/)
unit UBox;
interface
type
/// <summary>Generic class that wraps a type in an object.</summary>
/// <remarks>Although this type can be used to wrap any type it is aimed at
/// wrapping value types and strings.</remarks>
@delphidabbler
delphidabbler / UEnvVars.pas
Last active March 21, 2021 15:26
A collection of Delphi environment variable routines presented in the article "How to access environment variables" at http://delphidabbler.com/articles?article=6
unit UEnvVars;
interface
uses
// Delphi
Classes;
@delphidabbler
delphidabbler / .gitignore
Created March 8, 2014 01:15
General .gitignore file that I use for Delphi 7 to XE
# General .gitignore file suitable for Delphi 7 to XE
*.ddp
*.exe
*.dll
*.bpl
*.bpi
*.dcp
*.so
*.apk
@delphidabbler
delphidabbler / UExeType.pas
Last active November 15, 2022 10:50
Delphi Pascal function and type that can detect if a file is a DOS or Windows executable and determine its type.
// MIT License https://delphidabbler.mit-license.org/2022-
// Copyright (c) 2022, Peter D Johnson (https://gravatar.com/delphidabbler)
unit UExeType;
interface
type
TExeType = (
etUnknown, // unknown file kind: not an executable