You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:
name = name || 'joe';
This is quite common and very helpful. Another option is to do:
name || (name = 'joe');
<?php | |
echo '<pre>'; | |
echo '<span style="color:blue">DOWNLOADING...</span>'.PHP_EOL; | |
// Download file | |
file_put_contents('wp.zip', file_get_contents('http://wordpress.org/latest.zip')); | |
$zip = new ZipArchive(); | |
$res = $zip->open('wp.zip'); | |
if ($res === TRUE) { |
<?php | |
$unzip = new ZipArchive; | |
$out = $unzip->open('file-name.zip'); | |
if ($out === TRUE) { | |
$unzip->extractTo(getcwd()); | |
$unzip->close(); | |
echo 'File unzipped'; | |
} else { | |
echo 'Something went wrong?'; |
#!/usr/bin/env bash | |
sqllocation=~/.sql_backup_files | |
# echo $(wp --version) | |
wp --version >/dev/null 2>&1 || { | |
echo "I need 'wp' command to be able to execute further" | |
exit 1 | |
} | |
# Check if it is a wordpress directory or is installed |
#!/bin/bash | |
# Setup Variables | |
DBNAME=dbname | |
DBUSER=dbuser | |
DBPASS=dbpass | |
DBHOST=localhost | |
DBPREFIX=oxo_ | |
URL=http:// |
You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:
name = name || 'joe';
This is quite common and very helpful. Another option is to do:
name || (name = 'joe');
<?php | |
/* | |
* Converts CSV to JSON | |
* Example uses Google Spreadsheet CSV feed | |
* csvToArray function I think I found on php.net | |
*/ | |
header('Content-type: application/json'); | |
// Set your CSV feed |
This script fetches all of the files from the currently deployed version of a Firebase Hosting site. You must be signed in via the Firebase CLI and have "Site Viewer" permission on the site in question to be able to properly run the script.
npx https://gist.github.com/mbleigh/9c8680cf319ace2f506f57380da66e7d <site_name>