Results: 1580
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
for (let i = 0; i < 5; i++) {
    console.log(`Inside the loop: ${i}`);
}

console.log(`Outside the loop: ${i}`);
output:
Inside the loop: 0
Inside the loop: 1
Inside the loop: 2
Inside the loop: 3
Inside the loop: 4
and will be error:
Uncaught ReferenceError: i is not defined
because t the variable 'i' only exists and can be accessible inside the for loop block.
by Luka Tatarishvili
4 years ago
0
JavaScript
variables
1
The global var variables are added to the global object as properties.
var counter = 0;
console.log(window.counter); //  0
However, the let variables are not added to the global object:
let counter = 0;
console.log(window.counter); // undefined
by Luka Tatarishvili
4 years ago
0
JavaScript
variables
1
The var keyword allows us to redeclare a variable without any issue:
var counter = 10;
var counter;
console.log(counter); // 10
However, if we redeclare a variable with the let keyword, we will get an error:
let counter = 10;
let counter; // undefined
by Luka Tatarishvili
4 years ago
0
JavaScript
variables
1
php artisan make:model Asset -m -c -r
Long version of the above command would be:
php artisan make:model Asset --migration --controller --resource
by Valeri Tandilashvili
4 years ago
0
Laravel
artisan commands
1
The password
123
will be encrypted and then decrypted back with
AES-128-ECB
encryption algorithm. Encrypts the text using the secret key
sec key
function encrypt_text($text, $secret_key)
{
    return openssl_encrypt($text,"AES-128-ECB", $secret_key);
}
Decrypts encrypted text (first parameter) using the secret key (second parameter)
function decrypt_text($encrypted_string, $secret_key)
{
    return openssl_decrypt($encrypted_string,"AES-128-ECB", $secret_key);
}
Calls the above two functions to perform encryption and decryption
// Secret key, that is used to encrypt and decrypt the 
$text
content $secret = 'sec key'; // the text that we want to encryption and decryption $text = '123'; $password_encrypted = encrypt_text($text, $secret); $password_decrypted = decrypt_text($password_encrypted, $secret); echo 'Encrypted text: ' . $password_encrypted . '<br>'; echo 'Decrypted password: ' . $password_decrypted;
by Valeri Tandilashvili
4 years ago
0
PHP
encrypt/decrypt
1
fields types in mysql table relationships
In
many to many
relationship
user_id
inside
user_roles
table must be exactly the same as the
id
field inside
users
table Example: if
users->id
is
bigint(20) unsigned
then
user_role->user_id
must be exactly
bigint(20) unsigned
by Valeri Tandilashvili
4 years ago
0
Laravel
1
calculate age based on the provided date of birth
function age($dob) {
    // Seconds in a year
    $seconds = 31556926;

    // Calc. age based on the provided date_of_birth val
    $age = floor((time() - strtotime($dob)) / $seconds);

    return $age;
}
by Valeri Tandilashvili
4 years ago
0
PHP
1
Fetches all HTTP headers from the current request
print_r(json_encode(getallheaders()));
The result of the above code is:
{
    "Content-Type": "application/json",
    "User-Agent": "PostmanRuntime/7.26.8",
    "Accept": "*/*",
    "Postman-Token": "a89b677d-776a-45d7-988c-f18ad2512522",
    "Host": "localhost",
    "Accept-Encoding": "gzip, deflate, br",
    "Connection": "keep-alive",
    "Content-Length": "137"
}
by Valeri Tandilashvili
4 years ago
0
PHP
functions
1
noreferrer on links
Links to cross-origin destinations were not safe (
lighthouse
) Advice: Add
rel="noopener"
or
rel="noreferrer"
to any external links to improve performance and prevent security vulnerabilities
<a class="a_" rel="noreferrer" href="http://orthodoxy.ge" target="_blank" title="მართლმადიდებლური საიტი orthodoxy.ge">orthodoxy.ge</a>
Links that the
noreferrer
was used:
orthodoxy.ge
teodore.ge
qadageba.ge
by Valeri Tandilashvili
4 years ago
0
HTML
lighthouse
1
jQuery vulnerabilities
Older version of jQuery library has XSS vulnerabilities (lighthouse) Because of that
jquery-1.7.2.min.js
was replaced by
jquery-3.5.1.min.js
by Valeri Tandilashvili
4 years ago
0
jQuery
lighthouse
1
Results: 1580