Skip to content

Instantly share code, notes, and snippets.

View valiantboymaksud's full-sized avatar
📚
Focusing

MaD valiantboymaksud

📚
Focusing
View GitHub Profile
1 Add the Ondrej PPA Repository
PHP 7.4 is the default PHP version in Ubuntu 20.04 repositories at the time of writing this tutorial. We will use the Ondrej PPA repositories to install the latest version of PHP. This repository contains multiple PHP versions and PHP extensions.
First, let’s update your Ubuntu system packages and install some dependencies as shown below.
$ sudo apt update
$ sudo apt upgrade
# Allow apt to use the repository via HTTPS
@valiantboymaksud
valiantboymaksud / simultaneous HTTP requests with axios
Created February 13, 2023 05:10
simultaneous HTTP requests with axios
Here’s a simple example of how to use axios.all to make simultaneous HTTP requests:
// execute simultaneous requests
axios.all([
axios.get('https://api.github.com/users/mapbox'),
axios.get('https://api.github.com/users/phantomjs')
])
.then(responseArr => {
//this will be executed only when all requests are complete
console.log('Date created: ', responseArr[0].data.created_at);
@valiantboymaksud
valiantboymaksud / select2 createTag
Created February 12, 2023 10:40
select2 add option with new keyword
createTag: function (params) {
return {
id: params.term,
text: params.term,
newOption: true
}
},
templateResult: function (data) {
var $result = $("<span></span>");
@valiantboymaksud
valiantboymaksud / mysql_restore
Last active December 8, 2022 05:39
mysql dump gzip file
unzip the sql file then upload directory to the database using pipeline command
gunzip -c /filepath.gz | mysql -u username -p database_name
@valiantboymaksud
valiantboymaksud / Cannot use a scalar value as an array
Created November 27, 2022 10:51
Cannot use a scalar value as an array PHP
A bit late, but to anyone who is wondering why they are getting the "Warning: Cannot use a scalar value as an array" message;
the reason is because somewhere you have first declared your variable with a normal integer or string and then later you are trying to turn it into an array.
hope that helps
@valiantboymaksud
valiantboymaksud / auto-select.js
Last active November 26, 2022 04:07
Auto Select which help to select option value dynamically. You can also select multiple option
const { isArray } = require("lodash");
$('select').each(function() {
let _this = $(this)
let selected = $(this).data('selected');
if (isArray(selected)) {
selected.forEach(element => {
_this.val(element).prop('selected', 'selected')
@valiantboymaksud
valiantboymaksud / apache2 folder permission
Last active August 8, 2022 08:58
apache2 folder permission
sudo usermod -a -G www-data $USER
sudo chown root:root /var/www
sudo chmod -R 755 /var/www
sudo chown -R www-data:www-data /var/www/*
You can do the all the recommended steps in just 3 commands instead of 8 commands:
@valiantboymaksud
valiantboymaksud / rewritemode
Created August 7, 2022 08:53
Ubuntu apache2 rewrite mod for directory
<Directory /var/www/html/xgroup>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
@valiantboymaksud
valiantboymaksud / Full Apache2, Multi PHP & MariaDB - Web Server on Ubuntu 18.04 or later
Created August 4, 2022 18:06
Full Installation and Configuration of Apache2, Multiple PHP, MariaDB, phpMyAdmin, LetsEncrypt, HTTP/2, IonCube, Postfix, Dovecot, SPF, DKIM, Roundcube Webmail and Files Permission Commands on Ubuntu 18.04 and 18.10 Web Server
Complete Installation and Configuration of Apache2, Multiple PHP, MariaDB, phpMyAdmin, LetsEncrypt,
HTTP/2, IonCube, Postfix, Dovecot, SPF, DKIM, Roundcube Webmail and
Files Permission Commands on Ubuntu 18.04 and 18.10 Web Server
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
This is a complete Ubuntu Linux based web server for Website, PHP, SSL, TLS, Database and Email hosting purpose.
Built with the below components for good performance. Also, I tried to make it as secure as possible.
@valiantboymaksud
valiantboymaksud / district.php
Last active January 14, 2023 05:26
District Array
$districts = array(
array('id' => '1','created_by' => '1','updated_by' => '1','name' => 'Natore','created_at' => '2021-09-08 17:11:24','updated_at' => '2021-09-08 17:11:24'),
array('id' => '2','created_by' => '1','updated_by' => '1','name' => 'Naogan','created_at' => '2021-09-08 17:11:24','updated_at' => '2021-09-11 18:16:11'),
array('id' => '3','created_by' => '1','updated_by' => '1','name' => 'Chuadanga','created_at' => '2021-09-08 17:11:24','updated_at' => '2021-09-08 17:11:24'),
array('id' => '4','created_by' => '1','updated_by' => '1','name' => 'Chittagong','created_at' => '2021-09-08 17:11:24','updated_at' => '2021-09-08 17:11:24'),
array('id' => '5','created_by' => '1','updated_by' => '1','name' => 'Bogra','created_at' => '2021-09-08 17:11:24','updated_at' => '2021-09-08 17:11:24'),
array('id' => '6','created_by' => '1','updated_by' => '1','name' => 'Sylhet','created_at' => '2021-09-08 17:11:24','updated_at' => '2021-09-08 17:11:24'),
array('id' => '7','created_by' => '1','updated_by' =>