Skip to content

Instantly share code, notes, and snippets.

View thinkphp's full-sized avatar

Adrian Statescu thinkphp

View GitHub Profile
// Cerere asincronă simplă
async function cautaProdus() {
// Arată că suntem în proces de încărcare
console.log('Se caută produsul...');
try {
// Trimite cererea - nu blochează alte lucruri
const raspuns = await fetch('https://fakestoreapi.com/products/1');
// Convertește răspunsul în JSON
@thinkphp
thinkphp / async.js
Created March 4, 2025 17:03
functie asyncrona
async function obtineDateUtilizator(idUtilizator) {
try {
// Folosim fetch pentru a face cererea
const raspuns = await fetch(`https://jsonplaceholder.typicode.com/users/${idUtilizator}`);
// Convertim răspunsul în format JSON
const date = await raspuns.json();
// Afișăm datele utilizatorului
console.log('Date utilizator:', date);
async function testFoursquareAPI() {
const API_KEY = 'fsq3agVQLNiAKtKnzwe53yyFL0AYlwnuqcaolD0V8Dl+ssg=';
const endpoint = 'https://api.foursquare.com/v3/places/search?near=Sibiu,Romania&limit=3';
try {
console.log('🔍 Testing Foursquare API connection...');
const response = await fetch(endpoint, {
headers: {
'Authorization': API_KEY,
@thinkphp
thinkphp / n!factorizationPrime1.txt
Last active February 28, 2025 07:43
BreakingDownn!factorizationPrime1.txt
#include <iostream>
using namespace std;
int vec[1001], d, m, n, x;
int main() {
cout << "n ( <=1000 ) = ";
cin >> n;
for (int tt = 2; tt <= n; ++tt) {
<!DOCTYPE html>
<html>
<head>
<title>W3.CSS Template</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway">
<style>
body,h1 {font-family: "Raleway", sans-serif}
@thinkphp
thinkphp / stack-teorie.md
Last active January 20, 2025 15:19
Stack Data Structure Teorie

O stiva functionează pe principiul LIFO (Last In First Out) - ultimul element adăugat este primul care iese. Gandeste-te la o stiva de obiecte - poti adăuga sau lua doar de sus.

#define MAX_SIZE 100

// Structura stivei
typedef struct {
    int array[MAX_SIZE];  // Array-ul care stocheaza elementele
    int top;             // Indexul varfului stivei
} Stack;
@thinkphp
thinkphp / vector-n-dimensional.asm
Created January 19, 2025 03:38
Fragment de program: determina valoarea absoluta intreaga |v| = sqrt(v1^2 + v2^2 + ... + v3^2) a unui vector V intr-un spatiu n-dimensional. Respecta conventiile IA-32
section .data
prompt_n db "Vector intr-un spatiul n-dimensional (n): ", 0
prompt_num db "Enter number %d: ", 10, 0
result_msg db "Sum of squares is: %ld", 10, 0
sqrt_msg db "Square root of sum is: %lf", 10, 0
fmt_int db "%ld%*c", 0
section .bss
n resq 1
current_num resq 1
@thinkphp
thinkphp / Exercitiul7punctulc).asm
Created January 19, 2025 03:29
Exercitiul 7 punctul c) Pipeline IF ID LD EX WB
Folosind timpul pipiline de 130 ps determinat anterior.
Instrucțiunile sunt:
- ADD R3, R2, R1 (R3 ← R2 + R1)
- SUB R4, R1, R3 (R4 ← R1 - R3)
Identificarea dependenței:
Avem o dependență de tip RAW (Read After Write) deoarece:
- Prima instrucțiune (ADD) scrie în R3
- A doua instructiune (SUB) citește R3
@thinkphp
thinkphp / coeficient-binomial.asm
Created January 16, 2025 11:14
Coeficient binomial (n,k)
section .data
n dd 5 ; n = 5
k dd 2 ; k = 2
section .text
global _start
_start:
mov eax, 1 ;
mov ecx, 1 ;
@thinkphp
thinkphp / maxabs.asm
Created January 16, 2025 10:34
Cauta valoarea maxima absoluta intr-un vector
section .data
vec DD -5, -7, 3, -17, 8, -2, 0 ; vector exemplu
section .text
global _start
_start:
xor ebx, ebx ; ebx = 0 (maxim curent)
mov esi, vec ; esi = adresa vectorrului