Skip to content

Instantly share code, notes, and snippets.

View AdriaanBoshoff's full-sized avatar

Adriaan AdriaanBoshoff

  • South Africa
View GitHub Profile
@AdriaanBoshoff
AdriaanBoshoff / getEdgeBrowserCookies.pas
Last active December 15, 2023 06:42
Example on how to get cookies from TEdgeBrowser in Delphi 12
unit ufrmMain;
/////////////////////////////////////////////////////////////////////////////////////
/// Example on how to grab cookies from TEdgeBrowser in Delphi 12
/// Form contains 1 TButton and 1 TEdgeBrowser.
/// Flow:
/// 1. OnFormCreate event fires then sets the UserData folder and Navigates to website.
/// 2. Click on button. It will then invoke the cookie manager which fires TMyCookieHandler.Invoke event
/// where you grab the cookies.
/////////////////////////////////////////////////////////////////////////////////////
@AdriaanBoshoff
AdriaanBoshoff / DiscordMessage.pas
Last active July 18, 2023 07:00
Delphi Send Discord Message
uses
Rest.Client, Rest.Types;
function SetupRestRequest: TRESTRequest;
begin
Result := TRESTRequest.Create(Self);
Result.Client := TRESTClient.Create(Result);
Result.Response := TRESTResponse.Create(Result);
Result.Client.BaseURL := 'https://discord.com/api/v' + Settings.Discord.API_Version.ToString;
@AdriaanBoshoff
AdriaanBoshoff / FMX.TStringGrid.DeleteRow.pas
Created November 13, 2021 08:10
FMX TStringGrid Delete Row Helper
unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes,
System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, System.Rtti,
FMX.Grid.Style, FMX.StdCtrls, FMX.Controls.Presentation, FMX.ScrollBox,
FMX.Grid;
@AdriaanBoshoff
AdriaanBoshoff / list-stylebooks.pas
Last active January 27, 2019 12:29
List all stylebooks in a FMX app
using
System.SysUtils, System.Classes, FMX.Types, FMX.Controls, FMX.Dialogs;
procedure ListAllStyles;
var
i: Integer;
astyle: TStyleBook;
begin
for i := 0 to self.ComponentCount - 1 do
begin
@AdriaanBoshoff
AdriaanBoshoff / uHelpers.pas
Created January 22, 2019 09:11
MultiPlatform Helpers for Delphi
function UTCtoLocalDateTime(const UTCDateTime: TDateTime): TDateTime;
var
LocalSystemTime: TSystemTime;
UTCSystemTime: TSystemTime;
LocalFileTime: TFileTime;
UTCFileTime: TFileTime;
begin
DateTimeToSystemTime(UTCDateTime, UTCSystemTime);
SystemTimeToFileTime(UTCSystemTime, UTCFileTime);
if FileTimeToLocalFileTime(UTCFileTime, LocalFileTime) and FileTimeToSystemTime(LocalFileTime, LocalSystemTime) then
@AdriaanBoshoff
AdriaanBoshoff / tag parser
Created June 22, 2018 19:36
Get text between 2 tags.
function FindText(const aText, aTagLeft, aTagRight: string): string;
var
xml: TStringList;
iLeft, iRight: Integer;
begin
xml := TStringList.Create;
try
xml.Text := aText;
iLeft := Pos(aTagLeft, xml.Text) + Length(aTagLeft);
@AdriaanBoshoff
AdriaanBoshoff / PlayerController.cs
Last active December 23, 2017 16:44
(Unity 2D) Player movement and stops current sprite from moving out of the camera view.
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
public float speed = 15.0f;
public float padding = 1f;
float xmin;
float xmax;
@AdriaanBoshoff
AdriaanBoshoff / steam_console_params.txt
Created June 26, 2017 20:08 — forked from davispuh/steam_console_params.txt
Steam client parameters, consoles commands and variables
-480p - Run tenfoot in 480p rather than 1080p
-720p - Run tenfoot in 720p rather than 1080p
-accountrecovery - Perform account recovery
-all_languages - show longest loc string from any language
-bigpicture - Start in Steam Big Picture mode
-cafeapplaunch - Launch apps in a cyber cafe context
-candidates - Show libjingle candidates for local connection as they are processed
-ccsyntax - Spew details about the localized strings we load
-community - Set the community URL
-complete_install_via_http - Run installation completion over HTTP by default