Skip to content

Instantly share code, notes, and snippets.

@pakLebah
pakLebah / carRace.pas
Last active February 18, 2022 12:01
Pascal car racing on console using ansiCRT unit.
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
@pakLebah
pakLebah / fancyInput.pas
Last active October 2, 2024 13:18
Fancy input for console program.
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 / calc.pas
Last active January 12, 2020 04:03
Simple calculator program using custom math expression parsing.
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 / launch.json
Last active September 2, 2024 03:23
My VS Code tasks for Apple's Swift programs on Mac.
{
// 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 / launch_task.sh
Last active October 18, 2018 02:06
Toggle Mojave's dark mode automatically based on given time.
# 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 / ansiCRT.pas
Last active October 2, 2024 13:15
ANSI code unit and demo program using Free Pascal.
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 / chinook.db
Last active August 12, 2024 23:39
Simple SQlite demo with Free Pascal.
@pakLebah
pakLebah / launch.json
Last active July 21, 2023 15:39
My VS Code tasks for Free Pascal programs on Mac.
{
// 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 / bounce.lpr
Last active July 28, 2018 16:10
LCL canvas graphics demo.
program bounce;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, lazcontrols, ubounce;