Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block w4r0

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
w4r0 / Binding_params.php
Last active Oct 24, 2019
Dynamically binding params in prepared statment
View Binding_params.php
$array = [1,2,3,4,5,6,7];
$count_array = count($array);
$placeholders = implode(',', array_fill(0, $count_array, '?'));
$query = $DB->Prepare('
SELECT id, name
FROM table_name
WHERE id IN (' . $placeholders . ')
w4r0 / install-wine4-ubuntu18.04.txt
Last active Oct 29, 2019
Installing Wine 4.0 on Ubuntu 18.04 and Linux Mint 19
View install-wine4-ubuntu18.04.txt
$ sudo dpkg --add-architecture i386
$ sudo apt update
$ wget -qO- | sudo apt-key add -
$ sudo apt-add-repository 'deb bionic main'
$ sudo apt update
View gist:dde9fa08b51b3b64c23c30c16038c125
Get how many rows in whole database
w4r0 / php.ini for development
Created Apr 27, 2019
PHP configuration for development machine
View php.ini for development
; For dev only
error_reporting = E_ALL
; Should be 'off' on prod server
w4r0 / gist:dfaac200e8a0c1b12ac8fda889f841f2
Last active Nov 9, 2019
My Recurring Linux Command Line
View gist:dfaac200e8a0c1b12ac8fda889f841f2
List file and its subdirectories, filename only
ls -1R > lsir.txt
Copy a file into a directory and its subdirectories:
sudo find <target-dir> -type d -exec cp <the file> {} \;
Change permission files recursively:
sudo find /var/www/html/ -type d -exec chmod 775 {} +
Change permission directory and its subdirectories recursively:
w4r0 / gist:ff2b06464121d1aabec7287f37f00d1a
Last active Aug 19, 2019
Linux Aliases to Switch Amongs PHP Versions
View gist:ff2b06464121d1aabec7287f37f00d1a
Assuming I have three different PHP versions on my system:
1. PHP 5.6
2. PHP 7.1
3. PHP 7.2
To switch two between versions, add these aliases into your ~/.bashrc file:
alias php5671='sudo a2dismod php5.6 ; sudo a2enmod php7.1 ; sudo service apache2 restart ; echo 2 | sudo update-alternatives --config php'
alias php5672='sudo a2dismod php5.6 ; sudo a2enmod php7.2 ; sudo service apache2 restart ; echo 3 | sudo update-alternatives --config php'
View gist:743a04fd3add430c19237c393a5103a9
$all_vars = get_defined_vars();
You can’t perform that action at this time.