This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Palindrome | |
{ | |
public static function isPalindrome($word) | |
{ | |
if($word && is_string($word)){ | |
$word = strtolower($word); | |
$wordReverse = strrev($word); | |
$isPalindrome = $word==$wordReverse ? true : false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select count(1) from students where firstName='John'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select name from employees | |
where id not in (select managerId from employees where managerId is not null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Pipeline | |
{ | |
public static function make_pipeline() | |
{ | |
$funcs = func_get_args(); | |
return function($arg) use ($funcs) | |
{ | |
foreach($funcs as $function) { | |
if(!isset($value)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Crop Image Before Upload</title> | |
<script src="https://code.jquery.com/jquery-3.6.3.min.js" integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script> | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"> | |
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#dump 1 table | |
pg_dump -v --table=table_name --data-only --column-inserts -h 127.0.0.1 -U postgres_user postgres_db > ~/dump.sql | |
#structure and dump all tables | |
pg_dump -v -h 127.0.0.1 -U postgres_user postgres_db > ~/postgres-db.sql | |
#import | |
psql -h 127.0.0.1 -U postgres_user postgres_db < ~/postgres-db.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#export | |
mysqldump --set-gtid-purged=OFF -h host_source -u username -p db_name > ~/dump.sql; | |
#import | |
mysql -h host_destination -u username -p db_name < ~/dump.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<div id="qrcode"></div> | |
<script src="https://cdn.rawgit.com/davidshimjs/qrcodejs/gh-pages/qrcode.min.js"></script> | |
<script> | |
// Get the reference to the HTML element where the QR code will be displayed | |
const qrcodeContainer = document.getElementById('qrcode'); | |
// Generate the QR code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
<style> | |
.wrapper{ | |
max-height: 120px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get all the input fields | |
var inputs = document.querySelectorAll('input'); | |
// Set a flag to track if any input fields are empty | |
var emptyFields = false; | |
// Loop through the input fields | |
for (var i = 0; i < inputs.length; i++) { | |
// Check if the current input field is empty | |
if (inputs[i].value === '') { |