Skip to content

Instantly share code, notes, and snippets.

View evagoras's full-sized avatar

Evagoras Charalambous evagoras

View GitHub Profile
@evagoras
evagoras / ImageUtils.ts
Last active April 26, 2025 08:33
Keep Images Honest: Zero-Dependency Aspect Ratio Testing with Playwright
import { Locator } from '@playwright/test';
export interface AspectRatioResult {
withinTolerance: boolean;
deviationPct: number;
naturalRatio: number;
renderedRatio: number;
}
/**
@evagoras
evagoras / googleMapsUtility.ts
Last active April 21, 2025 14:52
Automating Google Maps Interactions in Playwright: Pan, Zoom & Camera Controls
import { Locator, Page, TestInfo } from '@playwright/test';
export type MapAction =
| { type: 'pan'; direction: 'up' | 'down' | 'left' | 'right'; times: number }
| { type: 'zoom'; direction: 'in' | 'out'; times: number };
export class GoogleMapsUtility {
readonly page: Page;
readonly testInfo: TestInfo;
@evagoras
evagoras / recaptcha.spec.ts
Last active January 5, 2025 17:30
How to test reCaptcha forms in Playwright using TypeScript
import { expect, test } from '@playwright/test'
import { RecaptchaSection } from '../page-sections/recaptchaSection'
test('displays no errors when everything is correctly completed and form is submitted', async ({ page }, testInfo) => {
const recaptchaInstance = new RecaptchaSection(page, testInfo)
// go to the form page
await page.goto('/contact-us')
// fill out any form fields and click the submit button
await page.locator('#btnSubmit').click()
// this solves the reCAPTCHA if shown
@evagoras
evagoras / before-2021
Created September 28, 2023 16:12
Clarifying the use of the DateFormat ‘D’ mask for ACF2021+
<cfscript>
writeOutput( dateFormat( createDate( "2023", "01", "01" ), "YYYY-MM-DD" ) );
</cfscript>
@evagoras
evagoras / .wsh
Last active September 28, 2023 15:33
The Windows 2000 Indexing Service
[ScriptFile]
Path=C:\ServerScripts\SendEmailOnServiceFail.vbs
[Options]
Timeout=20
DisplayLogo=1
@evagoras
evagoras / class
Created September 28, 2023 15:25
A Generic GetRows VBScript Class
Class Database
Dim i_dbConnection
Dim i_objConn
Dim i_objRS
Private Sub Class_Initialize()
Const MAX_TRIES = 10
Dim intTries
On Error Resume Next
@evagoras
evagoras / checkbox
Last active September 28, 2023 15:05
Web-based Content Editor using IFrame
<input type="checkbox" onclick="setMode(this.checked)">
@evagoras
evagoras / new-mail
Created September 28, 2023 14:22
Formatting complex ASP output using HTML templates
...
Set objEmail = Server.CreateObject("CDONTS.NewMail")
objEmail.BodyFormat = 0 'CdoBodyFormatHTML objEmail.MailFormat = 0 'CdoMailFormatMime
objEmail.From = strEmail
objEmail.To = "[email protected]"
objEmail.Subject = strSubject
objEmail.Body = ReadFile("template.htm")
objEmail.Send
Set objEmail = Nothing
@evagoras
evagoras / add-output
Last active September 28, 2023 14:13
A Generic GetRows VBScript Class – Part II: Adding Update and AddNew functions
<%
Dim arrFields
Dim arrValues
Dim clsDatabase
Dim numNewID
Dim numCategoryID,strQuestion,strAnswer,numPosterID
numCategoryID = "5"
strQuestion = "What is this?"
strAnswer = "This is the answer."
numPosterID = "10"
@evagoras
evagoras / asp-multipleparamquery
Created September 28, 2023 14:06
Calling MS Access Parameterized Queries from ASP
...
strQuery = "faq_qry_sub_categories '" & numCategoryID & "', '" & secondparam & "'"
...