Skip to content

Instantly share code, notes, and snippets.

View pmcgee69's full-sized avatar

Paul McGee pmcgee69

  • Perth, Western Australia
View GitHub Profile
@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
@VictorTaelin
VictorTaelin / simple_fast_functional_sieve.md
Last active July 2, 2024 19:15
Can a simple functional sieve be fast? Optimizing Tromp's algorithm on HVM.

Can a simple functional sieve be fast? Optimizing Tromp's algorithm on HVM.

Today, John Tromp - creator of the Binary λ-Calculus, and one of the smartest functional wizards alive - ported his famous prime number generator (first published 12 years ago!) to HVM:

@jimmckeeth
jimmckeeth / MultiPlatformCryptoRando.pas
Last active June 5, 2024 17:08
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;
@jarroddavis68
jarroddavis68 / DelphiChatGPT.pas
Last active April 28, 2023 05:48
Use ChatGPT from Delphi
(****************************************************************************
___ _ _ _ ___ _ _ ___ ___ _____
| \ ___ | | _ __ | |_ (_) / __|| |_ __ _ | |_ / __|| _ \|_ _|
| |) |/ -_)| || '_ \| ' \ | || (__ | ' \ / _` || _|| (_ || _/ | |
|___/ \___||_|| .__/|_||_||_| \___||_||_|\__,_| \__| \___||_| |_|
|_|
Copyright © 2022-present tinyBigGAMES™ LLC
All Rights Reserved.
@Pasquina
Pasquina / Simplified Auto Ref Counting.txt
Created September 27, 2020 22:30
A Delphi Console Application to illustrate Automatic Reference Counting (Simplified)
program AutoFreeTest;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
System.Classes;
type
IAutoFree = interface
@fboes
fboes / morse_code.ino
Last active November 14, 2023 20:45
Arduino Morse Code Table for ASCII
// morseCodes[asciiCode - 32]
// Non-existend codes are represented by ""
String morseCodes[65] = {
" ", // 32 - [SPACE]
"-.-.--", // 33 - !
".-..-.", // 34 - "
"", // 35 - #
"...-..-",// 36 - $
"", // 37 - %
@Nikolaj-K
Nikolaj-K / category_theory_literature.md
Last active June 11, 2024 20:49
Recomended reading for the undergrad category theorist
@amakukha
amakukha / mostfreq.cpp
Last active August 7, 2022 18:01
Find k most frequent words in a file (fast implementation)
/*
* Solution of the Jon Bentley's k most frequent words problem using a prefix tree and
* a heap of size k. Worst case time complexity is O(N log k), where N is the total
* number of words.
*
* The problem is formulated in the Communications of the ACM 29,5 (May 1986), 364-369:
* "Given a text file and an integer k, you are to print the k
* most common words in the file (and the number of their
* occurrences) in decreasing frequency."
*
@fatcerberus
fatcerberus / monads4all.md
Last active February 24, 2024 07:58
Monads for the Rest of Us

Monads for the Rest of Us

by Bruce Pascoe - 1 May, 2019

"A monad is just a monoid in the category of endofunctors. What's the problem?" ~James Iry[^1]

The problem... is that there are several problems.

It's been said that monads bear a dreadful curse. Once you finally understand what they are, you begin to see them everywhere--but somehow become completely incapable of explaining them to anyone else. Many tutorial writers have tried to break the Great Curse--the Web is lousy with bold attempts and half successes that attest to this--and just as many have failed. Well, I'm here to address the elephant in the room[^2] and tell you that I intend to break the Great Curse once and for all.

There are basically two ways a monad tutorial tends to go. One is a paragraph or two of minimal descriptions of one or two common monads (Haskell's Maybe in particular is very popular), followed by a lot of intimidating Haskell syntax trying to explain--precisely--how it all fits together. This is well

@brilvio
brilvio / .gitlab-ci.yml
Created March 5, 2018 20:42
Gitlab-CI Delphi
stages:
- build
test:
stage: build
environment:
name: staging
script:
- git submodule update --init --remote #if you don't have submodules in your project you can remove this line
- SET BDS=C:\\Program Files (x86)\\Embarcadero\\Studio\\15.0