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 | |
check_in_distance($lat_a, $long_a, $lat_b, $long_b, $range) | |
{ | |
$dlat = ($lat_a / (180 / pi())) - ($lat_b / (180 / pi())); | |
$dlong = ($long_a / (180 / pi())) - ($long_b / (180 / pi())); | |
$c = pow(sin($dlat / 2), 2) + cos($lat_a); | |
$c = $c * cos($lat_b) * pow(sin($dlong / 2), 2); | |
$c = 2 * asin(sqrt($c)); | |
$c = 6371 * $c; |
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 | |
$tarFile = __DIR__ . '/file.tar'; | |
$extractTo = __DIR__ . '/'; | |
exec("tar -xf $tarFile -C $extractTo", $output, $returnCode); | |
if ($returnCode === 0) { | |
echo 'Extraction successful!'; | |
} else { |
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 | |
$zipFile = __DIR__ . '/web.zip'; | |
$extractTo = __DIR__ . '/'; | |
$zip = new ZipArchive; | |
if ($zip->open($zipFile) === TRUE) { | |
$zip->extractTo($extractTo); | |
$zip->close(); |
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
<div class="col-span-6"> | |
<!-- <label class="block ml-2 text-sm font-medium text-gray-700"> Photo </label> --> | |
<div class="mt-1 flex items-center"> | |
<span class="inline-block h-36 w-36 rounded-full overflow-hidden bg-gray-100"> | |
<svg class="h-full w-full text-gray-300" fill="currentColor" viewBox="0 0 24 24"> | |
<path d="M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z" /> | |
</svg> | |
</span> | |
<img src="" class="hidden h-36 w-36 rounded-full overflow-hidden object-fit"> | |
<button onclick="handleImage(this)" type="button" class="ml-5 bg-white py-2 px-3 border border-gray-300 rounded-md shadow-sm text-sm leading-4 font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">Change</button> |
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
{ | |
"New York": [ | |
"New York", | |
"Buffalo", | |
"Rochester", | |
"Yonkers", | |
"Syracuse", | |
"Albany", | |
"New Rochelle", | |
"Mount Vernon", |
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
const UsaStates = [ | |
'Alabama', | |
'Alaska', | |
'Arizona', | |
'Arkansas', | |
'California', | |
'Colorado', | |
'Connecticut', | |
'Delaware', | |
'Florida', |
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
const addHyphens = (inputField) => { | |
inputField.addEventListener('input', (event) => { | |
let value = event.target.value.replace(/-/g, ''); | |
let formattedValue = ''; | |
for (let i = 0; i < value.length; i++) { | |
if (i === 5 || i === 12) { | |
formattedValue += '-'; | |
} | |
formattedValue += value[i]; |
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 | |
function send_json($payload, $status_code = 200) | |
{ | |
header('Access-Control-Allow-Origin: *'); | |
header('Content-Type: application/json'); | |
is_callable('http_send_status') ? http_send_status($status_code) | |
: header("HTTP/1.1 $status_code"); | |
return exit(json_encode((object) $payload)); | |
} |
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 | |
function get_working_days($year, $month, $last_day = null) { | |
$total_month_days = date('t', strtotime("$year-$month-01")); | |
if ($last_day) { | |
$total_month_days = $last_day; | |
} | |
$working_days; |
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 | |
$request_payload = !empty($_POST) ? $_POST : array(); | |
$request_payload = empty($_POST) && !empty($_GET) ? $_GET : $request_payload; | |
$request_payload = isset($_SERVER['CONTENT_TYPE']) | |
&& $_SERVER['CONTENT_TYPE'] == 'application/json' | |
? json_decode(file_get_contents('php://input'), true) | |
: $request_payload; | |
$request_details = array( |