Skip to content

Instantly share code, notes, and snippets.

@pakLebah
pakLebah / bounce.lpr
Last active Jul 28, 2018
LCL canvas graphics demo.
View bounce.lpr
program bounce;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, lazcontrols, ubounce;
@pakLebah
pakLebah / launch.json
Last active Apr 6, 2021
My VS Code tasks for Free Pascal programs on Mac.
View launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{ // shortcut: F5 (start debugging)
"type": "lldb",
"request": "launch",
"name": "LLDB Debugger",
@pakLebah
pakLebah / chinook.db
Last active Aug 9, 2021
Simple SQlite demo with Free Pascal.
@pakLebah
pakLebah / ansiCRT.pas
Last active Nov 1, 2020
ANSI code unit and demo program using Free Pascal.
View ansiCRT.pas
unit ansiCRT;
(******************************************************************************
This unit is emulating classic Pascal's CRT unit text color management and
cursor movement using ANSI Escape Code sequence. Keyboard input handling &
screen windowing is not possible. For keyboard input, better use the FPC's
Keyboard unit.
ANSI Escape Code list taken from:
https://en.wikipedia.org/wiki/ANSI_escape_code
@pakLebah
pakLebah / launch_task.sh
Last active Oct 18, 2018
Toggle Mojave's dark mode automatically based on given time.
View launch_task.sh
# NOTES:
# • Don't forget to change every <HOME> in the scripts to your home folder name.
# • Copy .plist and .scpt files into your Library/LaunchAgents folder.
# • First time execution would require permission.
# • Toggle time is hard coded in the script as:
# – light mode: 07:00-17:00 (day time)
# – dark mode: 17:00-07:00 (night time)
# • Execution interval: every 10 minutes (600 seconds).
# load task
@pakLebah
pakLebah / launch.json
Last active May 19, 2021
My VS Code tasks for Apple's Swift programs on Mac.
View launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"name": "LLDB",
"cwd" : "${workspaceFolder}",
@pakLebah
pakLebah / calc.pas
Last active Jan 12, 2020
Simple calculator program using custom math expression parsing.
View calc.pas
program Calc;
(******************************************************************************
Program: calc.pas (Calculator)
Author : paklebah.github.io
Description:
Calc calculates value from a simple aritmathical formula. The purpose of
this program is to demonstrate a simple parsing algorithm to newbies.
Version history:
@pakLebah
pakLebah / fancyInput.pas
Last active Feb 1, 2020
Fancy input for console program.
View fancyInput.pas
program fancyInput;
(*****************************************************************************
This program demonstrates fancy input mechanism for console application by
simply using CRT unit. For example selecting an item from a drop down menu,
length-limited phone number input, and yes/no input. Hopefully, new Pascal
beginners will learn something from this sample program. Thank you. :)
//! WARNING! This program requires FPC v3.2+ with compiler option -S2chij-
@pakLebah
pakLebah / carRace.pas
Last active Feb 2, 2020
Pascal car racing on console using ansiCRT unit.
View carRace.pas
program CarRace;
(*****************************************************************************
This program demonstrates ansiCRT unit instead of the standard Pascal's CRT
unit. Also showing how to use emoji/unicode on console screen so the output
looks more fancy and as if on graphics screen. Of course, this can also be
done using the CRT unit.
ansiCRT is here: gist.github.com/pakLebah/c5e2bbd0b93c863b2122660111db68d1