Skip to content

Instantly share code, notes, and snippets.

View omonien's full-sized avatar

Olaf Monien omonien

View GitHub Profile
@omonien
omonien / Foo.pas
Created September 2, 2020 09:37
TFoo example Gist
Unit Foo;
interface
type
TFoo = class(TObject)
end;
implementation
end.
@omonien
omonien / Bytes.pas
Created July 16, 2020 18:50
Byte Array example
program Project46;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils;
var
SomeBytes: TBytes;
SomeByte: Byte;
@omonien
omonien / Aurelius.Demos.Union.pas
Last active February 6, 2020 11:56
UNION in Aurelius
//Concatenate two lists - which basically is what a union of two SQL SELECTS does
LCustomersUS := LManager.Find<TCustomer>
.Where((Linq['Country'] = 'US')
.List;
LCustomersCA := LManager.Find<TCustomer>
.Where((Linq['Country'] = 'CA')
.List;
LCustomersNorthAmerica.AddRange(LCustomersUS);
LCustomersNorthAmerica.AddRange(LCustomersCA);
@omonien
omonien / Unit1.pas
Last active February 1, 2020 22:25
Using other units
unit Unit1;
interface
function Foobar(AValue:integer):integer;
implementation
uses
Unit2;
@omonien
omonien / test.pas
Last active February 1, 2020 22:26
Handling NULL JSON values in Delphi
const
CUSTOMERS = '{"customers":[{"name":"Olaf"},{"name":"Big Bird"}]}';
CUSTOMERS_NULL = '{"customers":null}';
procedure TForm39.Button1Click(Sender: TObject);
var
LContainer: TJSONValue;
LCustomers: TJSONArray;
begin
//Here, the value is not nil, so you can just go ahead with GetValue