Skip to content

Instantly share code, notes, and snippets.

View martinusso's full-sized avatar
🏠
Working from home

Breno Martinusso martinusso

🏠
Working from home
View GitHub Profile
@martinusso
martinusso / OnlyNumbers.cs
Created May 5, 2014 19:18
only numbers in C#
class OnlyNumbers
{
private string value;
public OnlyNumbers(string value)
{
this.value = value;
}
public override string ToString()
@martinusso
martinusso / GetTimeZoneUTC.pas
Last active March 30, 2016 13:59
Find out current local time in Time Zone – UTC
var
TimeZoneInfo: TTimezoneinformation;
Minutes: Integer;
Sign: string;
begin
if not (GetTimezoneInformation(TimeZoneInfo) in [TIME_ZONE_ID_UNKNOWN, TIME_ZONE_ID_STANDARD, TIME_ZONE_ID_DAYLIGHT]) then
Result('');
Minutes := (TimeZoneInfo.Bias + TimeZoneInfo.DaylightBias) * -1;
if Minutes < 0 then
@martinusso
martinusso / select_trigger_firebird
Last active May 23, 2024 08:18
check if trigger exists (verificar se trigger existe) - Firebird
SELECT
RDB$TRIGGER_NAME FROM RDB$TRIGGERS
WHERE
RDB$TRIGGER_NAME = 'triggerName'
@martinusso
martinusso / register_using_regsam.bat
Last active January 24, 2017 12:28
Register a DLL using the regasm
%windir%\Microsoft.NET\Framework\v2.0.50727\regasm "%cd%\XYZ.dll" /tlb:"%cd%\XYZ.tlb"
pause
@martinusso
martinusso / Aws-SES-SMTP.pas
Last active August 29, 2015 14:22
Send mail using SMTP Aws-SES
procedure Aws_SES_SendMailUsingSMTP;
var
Username: string;
Password: string;
Host: string;
Port: Integer;
SmtpClient: TIdSMTP;
Msg: TIdMessage;
IdSSL: TIdSSLIOHandlerSocketOpenSSL;
@martinusso
martinusso / restore.bat
Last active August 29, 2015 14:26
Creating schema in database PostgreSQL
@echo off
if "%1" == "" goto :EOF
if "%2" == "" (
set database=monde
) else (
set database=%2
)
echo Creating schema %1 in database %database%
@martinusso
martinusso / the-programmers-idea.md
Last active February 4, 2025 00:42
The Programmers Idea

Numbers

Text

  • Reverse a String – Enter a string and the program will reverse it and print it out.
  • Pig Latin – Pig Latin is a game of alterations played on the English language game. To create the Pig Latin form of an English word the initial consonant sound is transposed to the end of the word and an ay is affixed (Ex.: "banana" would yield anana-bay). Read Wikipedia for more information on rules.
  • Count Vowels – Enter a string and the program counts the number of vowels in the text. For added complexity have it report a sum of each vowel found.
  • Check if Palindrome – Checks if the string entered by the user is a palindrome. That is that it reads the same forwards as backwards like “racecar”
  • Count Words in a String – Counts the number of individual words in a string. For added complexity read these strings in from a text file and generate a summary.
@martinusso
martinusso / emailAdressValidator.pas
Last active April 25, 2022 12:23
Delphi Email Address Validator
// uses RegularExpressions;
function ValidateEmail(const emailAddress: string): Boolean;
var
RegEx: TRegEx;
begin
RegEx := TRegex.Create('^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]*[a-zA-Z0-9]+$');
Result := RegEx.Match(emailAddress).Success;
end;
@martinusso
martinusso / phone
Last active April 5, 2018 16:03
regex
'^(?:(?:\+|00)?(\d)?)?([0-9]{10,12})$';
Grupo de trabalho
# Windows Vista and <
control userpasswords2
# Windows 7 and >
netplwiz