Skip to content

Instantly share code, notes, and snippets.

View viniciussanchez's full-sized avatar
:octocat:
Share knowledge

Vinicius Sanchez viniciussanchez

:octocat:
Share knowledge
View GitHub Profile
version: '2.1'
services:
horse:
image: hashload/delphi-dev:10.3.2-rio
privileged: true
tty: true
ports:
- '9000:9000'
- '64211:64211'
@viniciussanchez
viniciussanchez / recaptcha-response.json
Last active March 24, 2021 21:58
reCAPTCHA JSON response
{
"success": true,
"challenge_ts": "timestamp",
"hostname": "string",
"error-codes": []
}
@viniciussanchez
viniciussanchez / recaptcha-validate.pas
Last active March 24, 2021 21:58
reCAPTCHA Validate Delphi
const
BASE_URL = 'https://www.google.com/recaptcha/api/siteverify';
SECRET_KEY = 'MY SECRET KEY';
var
LResponse: IResponse;
begin
LResponse := TRequest.New.BaseURL(BASE_URL)
.AddParam('secret', SECRET_KEY)
.AddParam('response', 'TOKEN GERADO PELO CAPTCHA')
.Post;
@viniciussanchez
viniciussanchez / recaptcha-v3.html
Last active March 24, 2021 21:59
reCAPTCHA v3
<!DOCTYPE html>
<html lang="pt-br">
<head>
<title>reCaptcha</title>
<script src="https://www.google.com/recaptcha/api.js?render=PUBLIC KEY"></script>
</head>
<body>
<script>
grecaptcha.ready(function() {
grecaptcha.execute('PUBLIC KEY').then(function(token) {
@viniciussanchez
viniciussanchez / formData.pas
Last active January 17, 2024 17:29
How to send multipart/form-data with Delphi using THTTPClient
uses System.Net.HttpClient, System.Net.Mime;
function Send: string;
var
LRequest: THTTPClient;
LFormData: TMultipartFormData;
LResponse: TStringStream;
begin
LRequest := THTTPClient.Create;
LFormData := TMultipartFormData.Create();
unit Classes.Amigas;
interface
type
TCarro = class
private
FId: Integer;
FNome: string;
procedure SetId(const Value: Integer);
unit Solid.SRP.Violacao;
interface
type
TLogger = class
private
procedure SendMail;
public
procedure Log;
@viniciussanchez
viniciussanchez / Solid.SRP.MailService.pas
Last active April 9, 2021 03:05
Refatoração do SRP (SOLID)
unit Solid.SRP.MailService;
interface
type
TMailService = class
public
procedure SendMail;
end;
@viniciussanchez
viniciussanchez / Solid.SRP.Logger.pas
Last active April 9, 2021 03:05
Refatoração do SRP (SOLID)
unit Solid.SRP.Logger;
interface
type
TLogger = class
public
procedure Log;
end;
@viniciussanchez
viniciussanchez / Solid.OCP.Violacao.pas
Created April 15, 2021 11:15
Violação do OCP (SOLD)
unit Solid.OCP.Violacao;
interface
type
TBancoItau = class
public
procedure GerarBoleto;
end;