Skip to content

Instantly share code, notes, and snippets.

@Al-Muhandis
Al-Muhandis / zip_odt.pas
Created Sep 25, 2021
Example demonstrating filling out the odt documents files using the native FPC paszlib library
View zip_odt.pas
unit zip_odt;
{$mode ObjFPC}{$H+}
interface
uses
Classes, SysUtils;
procedure FillODTDoc(const aSrcFile, aDestFile: String; aKeyValuePairs: TStringList);
@Al-Muhandis
Al-Muhandis / project1.pas
Last active Sep 9, 2021
Compressing and decompressing. String input and output
View project1.pas
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
@Al-Muhandis
Al-Muhandis / configuration.pas
Last active Jul 17, 2021
Saving an object in JSON and loading it from it
View configuration.pas
// ... ... ...
uses fpjson, jsonscanner, fpjsonrtti
;
// ... ... ...
procedure LoadFromJSON(AObject: TObject; const AFileName: String);
var
ADeStreamer: TJSONDeStreamer;
View Unit1.pas
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
@Al-Muhandis
Al-Muhandis / cbrvalutes.pas
Last active Sep 5, 2020
Парсер валют (Центробанк РФ)
View cbrvalutes.pas
unit sbrvalutes;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, fgl
;
View dorpunycode.pas
{$mode Delphi}
(*
* punycode.c from RFC 3492prop
* http://www.nicemice.net/idn/
* Adam M. Costello
* http://www.nicemice.net/amc/
*
* This is ANSI C code (C89) implementing Punycode (RFC 3492prop).
* Delphi Conversion by:
View CSV.pas
procedure TForm1.FormCreate(Sender: TObject);
begin
InitiateMRating;
SdfDtStCountries.FieldDefs.Add('id', ftInteger, 2);
SdfDtStCountries.Schema.Add('id');
SdfDtStCountries.FieldDefs.Add('iso', ftString, 2);
SdfDtStCountries.Schema.Add('iso');
SdfDtStCountries.FieldDefs.Add('continent', ftString, 2);
SdfDtStCountries.Schema.Add('continent');
@Al-Muhandis
Al-Muhandis / blcksock.pas
Last active Feb 15, 2020
Hack in blcksock.pas (laz_synapse.lpk 40.1)
View blcksock.pas
procedure TTCPBlockSocket.HTTPTunnelDoConnect(IP, Port: string);
//bugfixed by Mike Green (mgreen@emixode.com)
var
s: string;
begin
//Port := IntToStr(ResolvePort(Port));
inherited Connect(FHTTPTunnelIP, FHTTPTunnelPort);
if FLastError <> 0 then
Exit;
FHTTPTunnel := False;
View tableebtities.pas
unit tableentities;
{$mode objfpc}{$H+}
{$interfaces corba}
interface
uses
Classes, SysUtils, dSQLdbBroker, fgl, fpjson, dClasses, dSqlBuilder
;
@Al-Muhandis
Al-Muhandis / taskworker.pas
Last active Mar 11, 2019
Worker thread template class with task queue (FIFO) without third-party components. FreePascal
View taskworker.pas
unit taskworker;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
type