Skip to content

Instantly share code, notes, and snippets.

View jimmckeeth's full-sized avatar

Jim McKeeth jimmckeeth

View GitHub Profile
@jimmckeeth
jimmckeeth / MerryChristmas.pas
Last active January 5, 2018 05:52
Merry Christmas from Embarcadero Technologies
// +-----------------------------------------------------------------+
// | Created with Petra Plugin For Sketch from www.applyingcode.com |
// | by Jim McKeeth, Embarcadero Technologies |
// | jim.mckeeth@embarcadero.com |
// +-----------------------------------------------------------------+
// | Merry Christmas, Happy Holidays, and have a great 2018 |
// +-----------------------------------------------------------------+
unit MerryChristmas;
@jimmckeeth
jimmckeeth / keybase.md
Last active January 17, 2019 04:36
Keybase proof

Keybase proof

I hereby claim:

  • I am jimmckeeth on github.
  • I am jimmckeeth (https://keybase.io/jimmckeeth) on keybase.
  • I have a public key ASBt3FFVworfFAq38crbjISewR-SE7eWTQsS_sCkpMCMrwo

To claim this, I am signing this object:

@jimmckeeth
jimmckeeth / IgnoreEditChanges.pas
Last active August 5, 2020 20:31
Simple CustomManagedRecords routine to automatically re-enable the OnChange event handler for FireMonkey edits (see blog post)
unit IgnoreEditChanges;
// https://blogs.embarcadero.com/ignore-changes-with-custom-managed-records/
// Custom Managed Records are a new feature introduced in 10.4 Sydney
interface
uses
System.Classes;
type
@jimmckeeth
jimmckeeth / PiDay2023.pas
Last active April 13, 2023 18:50
Pi Day 2023 with Delphi
// I created an updated blog post with new code, more accuracy, and digits:
// https://blogs.embarcadero.com/getting-big-with-pi-in-delphi/
unit PiDay2023;
interface
uses
Velthuis.BigIntegers,
Velthuis.BigDecimals;
// Use your favorite fork of https://github.com/TurboPack/RudysBigNumbers
@jimmckeeth
jimmckeeth / SimpleRot47.pas
Last active August 15, 2023 04:14
Implements the Rot47 text obfuscation and de-obfuscation routine for Delphi 10.4 Sydney (Similar to Rot13)
uses Math;
function ROT47(UnRot: string): string;
// More information https://en.wikipedia.org/wiki/ROT13#Variants
begin
Result := UnRot;
for var I := 1 to Length(Result) do
begin
var o := ord(Result[i]);
case o of
@jimmckeeth
jimmckeeth / manualadb.bat
Last active May 3, 2024 23:58
Manual ADB Deployment from RAD Studio Tools Menu
@echo off
REM Call from Delphi/RAD Studio IDE with the following parameters
REM $PATH($EXENAME) $NAMEONLY($PROJECT)
echo =============================================================
echo Be sure you Compile Android 64 and Deploy [Shift-Ctrl-Alt-F9]
echo.
echo Also set <application android:resizeableActivity="true"> in AndroidManifest.template.xml
echo =============================================================
echo Path: %1
set apk=%2\bin\%2.apk
@jimmckeeth
jimmckeeth / FizzBuzzEnterpriseEdition.dpr
Last active June 5, 2024 17:05
FizzBuzzEnterpriseEdition in Delphi
// This is a very simple "overengineered" version of FizzBuzz written in Delphi
// See also
// https://github.com/jongeorge1/FizzBuzzEnterpriseEdition-CSharp
// https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
program FizzBuzzEnterpriseEdition;
{$APPTYPE CONSOLE}
uses
@jimmckeeth
jimmckeeth / Weird.Boolean.ToString.pas
Created June 5, 2024 22:57
Using the ToString on a Boolean is weird
// function BoolToStr(B: Boolean; UseBoolStrs: Boolean = False): string;
Writeln('BoolToStr(??, True)'); // BoolToStr(??, True)
WriteLn('True = ' + BoolToStr(True, True)); // True = True
WriteLn('False = ' + BoolToStr(False, True)); // False = False
Writeln('BoolToStr(??, False)'); // BoolToStr(??, False)
WriteLn('True = ' + BoolToStr(True, False)); // True = -1
WriteLn('False = ' + BoolToStr(False, False)); // False = 0
// class function ToString(const Value: Boolean; UseBoolStrs:
// TUseBoolStrs = TUseBoolStrs.False): string;
@jimmckeeth
jimmckeeth / MultiPlatformCryptoRando.pas
Last active September 10, 2024 08:22
Delphi Cryptographically Secure Random Number Generator that works on all paltforms
// Tested on Windows, MacOS, Linux, and Android. From what I've read /dev/urandom works on iOS too.
unit MultiPlatformCryptoRando;
interface
uses System.Classes, System.SysUtils;
function CryptoRandoCardinal: Cardinal;
function CryptoRandoFloat: Single;
@jimmckeeth
jimmckeeth / _shadertoy-view-splitter.md
Last active August 24, 2025 20:54
Shadertoy View Splitter - JavaScript to add a splitter on the Shadertoy view page.

This JavaScript injects a splitter on the Shadertoy view page to make it easy to resize the view of the shader and the code editing area. I made a pull request to the unoffical Shadertoy plugin to include this feature.

Just run the script in your browser's console window on a Shadertoy view page. Double-click the splitter to revert the position, and right-click it to remove it.

screenshot of the splitter