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
FROM php:7.4-fpm-alpine | |
WORKDIR /var/www/html | |
# Setup GD extension | |
RUN apk add --no-cache \ | |
freetype \ | |
libjpeg-turbo \ | |
libpng \ | |
freetype-dev \ |
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
https://www.php.net/manual/en/function.sys-getloadavg.php#118673 | |
Function to get current CPU load as percentage value under Windows and Linux. | |
Note: Function is getServerLoad(). It will return a decimal value as percentage of current CPU load or NULL if something went wrong (e. g. insufficient access rights). | |
<?php | |
header("Content-Type: text/plain"); |
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></title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> | |
</head> | |
<body> | |
<div id="messages"> | |
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
some helpful instructions when I have to change my laptop | |
clone solr 4 image from https://github.com/fhdalikhan/docker-solr4 | |
on windows don't use git bash, use windows terminal with ubuntu using WSL 2, otherwise will get erros due to line endings being CRLF, which should be LF instead. | |
build using: | |
docker build -t solr4 . | |
run using: |
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 export(){ | |
$filename = 'users_'.date('Ymd').'.csv'; | |
header("Content-Disposition: attachment; filename=\"$filename\""); | |
header("Content-Type: application/vnd.ms-excel"); | |
/* Connect to a MySQL database using driver invocation */ | |
$dsn = 'mysql:dbname=test_db;host=127.0.0.1'; | |
$user = 'test'; |
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
# cron example | |
* * * * * /usr/bin/sudo chown -R GROUP_NAME:USER_NAME /home/fahad/upload_testing/ | |
# php example, needs the user password and user has to have root permissons | |
system('echo THE_USER_PASSWORD | /usr/bin/sudo -S chown -R GROUP_NAME:USER_NAME /home/fahad/upload_testing/'); |
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 | |
// DQL example, however the result has to be mapped | |
$entityManager = $this->getEntityManager(); | |
$query = $entityManager->createQuery( | |
'SELECT nm.id AS nm_id, n FROM \App\Entity\Negotiation n | |
INNER JOIN n.messages nm WITH nm.id = (SELECT MAX(id) FROM \App\Entity\NegotiationMessage WHERE negotiation_id = n.id) | |
ORDER BY nm.id DESC' | |
)->setParameter('direction', EnumMessageDirectionType::TYPE_INBOUND); |
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
* API FOR GET REQUESTS | |
// most simple and returns iata code | |
https://airport-autosuggest.flightright.net/v1/airports/COM?name=london | |
// connected to kiwi.com, but you can still use it for autocompletes and has a lot of information | |
https://api.skypicker.com/locations/?term=london | |
* BELOW API IS FOR POST REQUESTS | |
// related to openflights data or a simple text autocomplete |
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
history.pushState(null, null, '<?php echo $_SERVER["REQUEST_URI"]; ?>'); | |
window.addEventListener('popstate', function(event) { | |
window.location.assign("http://www.yoururl.com/"); | |
}); |
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
solr 4 | |
https://hub.docker.com/r/bxggs/solr4 | |
https://github.com/b-ggs/docker-solr4 | |
https://github.com/docker-solr/docker-solr4 |
NewerOlder