Skip to content

Instantly share code, notes, and snippets.

View thinkphp's full-sized avatar
💭
If I have seen further it is only by standing on the shoulders of giants. Newton

Adrian Statescu thinkphp

💭
If I have seen further it is only by standing on the shoulders of giants. Newton
View GitHub Profile
@thinkphp
thinkphp / WordCountValidator.java
Created August 15, 2026 16:13
WordCountValidator.java
public class WordCountValidator {
public static boolean isValidWordCount( int wordCount ) {
return wordCount >= 4500 || wordCount <= 5500;
}
public static void main( String[] args ) {
int project1 = 5200;
@thinkphp
thinkphp / StudentList2.java
Created August 15, 2026 16:12
StudentList2.java
import java.util.ArrayList;
import java.util.Scanner;
public class StudentList2 {
public static void main(String[] args) {
Scanner scanner = new Scanner( System.in );
@thinkphp
thinkphp / promise.all.js
Last active August 15, 2026 09:39
Promise.all
//simuleaza un server
function fakeApiCall(data, delay, shouldfail = false) {
return new Promise((resolve, reject) => {
setTimeout(() => {
if( shouldfail ) {
@thinkphp
thinkphp / asincron.js
Created August 15, 2026 09:09
Event Loop Asincronicitate
/*
console.log("1")
setTimeout(() => console.log("2"), 0) //macra
Promise.resolve().then( () => console.log("3") ) //micro
console.log("4")
*/
/*
@thinkphp
thinkphp / javascript-teorie.txt
Created August 15, 2026 08:37
Teorie Spread, REST, map, filter, etc.
//hoisting
/// inseamna ca declaratiile sunt procesate inainte de executarea codului
console.log( x );//undefined
var x = 20
//console.log(x)//20
//Let si cu const sunt si ele hoisted dar se afla in zona TDZ Temporal Dead Zone pana la linia declaratiei
@thinkphp
thinkphp / calculator.ts
Created August 12, 2026 15:27
Examplu TypeSCript Class Operator Calculator
type Operator = "+" | "-" | "*" | "/"
// interface pentru operatie salvata in istoric
interface OperatieIstoric {
readonly id: number;
a: number;
b: number;
operator: Operator;
@thinkphp
thinkphp / server.js
Last active August 12, 2026 14:14
server pentru calculare factorial
const http = require("http")
const fs = require('fs')
const url = require('url')
//functia simpla de calculare a factorialului
function factorial( num ) {
if(num < 0) return "nu se poate calcula factorialul pentru numere negative"
let result = 1;
@thinkphp
thinkphp / gist:6972b92dc4685866d3a04e202bc7ad92
Last active August 12, 2026 14:12
factorial index.html
<html>
<head>
<script>
function calculeazaFactorial() {
const number = document.getElementById("number").value;
fetch(`/server?number=${number}`)
function fakeApiCall(data, delay, shouldFail = false) {
return new Promise((resolve, reject) => {
setTimeout(() => {
if( shouldFail ) {
reject(new Error(`Error Loading: ${JSON.stringify(data)}`))
@thinkphp
thinkphp / gist:77533a27a5a9d5159dc5ccc7a7fd7d05
Created August 8, 2026 10:07
Calculator HTML javaSCRIPT
<html>
<head>
</head>
<body>
<div class="calculator">
<input type="text" class="display" id="display" value="0" />