- Table of contents
- General information
- Terms
- General structure of a test
- WordPress-specific assertions and test functions
- enqueues
- creating posts
- creating terms
- attaching images
- ?
// Iterated from: https://stackoverflow.com/questions/10599933/convert-long-number-into-abbreviated-string-in-javascript-with-a-special-shortn | |
function abbreviateNumber(value) { | |
let newValue = value; | |
const suffixes = ["", "K", "M", "B","T"]; | |
let suffixNum = 0; | |
while (newValue >= 1000) { | |
newValue /= 1000; | |
suffixNum++; | |
} |
function formatBytes(bytes,decimals) { | |
if(bytes == 0) return '0 Bytes'; | |
var k = 1024, | |
dm = decimals || 2, | |
sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], | |
i = Math.floor(Math.log(bytes) / Math.log(k)); | |
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; | |
} | |
// Usage: |
#This is just a listing of the commands for generating your SSL certificates | |
#Run these commands one at a time from inside your ~/ssl folder | |
#Make sure you create your server.csr.cnf and your v3.ext files first inside the same folder | |
#private key generation | |
#This will ask you for a passphrase(password) do NOT lose this file or the password | |
openssl genrsa -des3 -out ~/ssl/rootCA.key 2048 | |
#create root certificate | |
openssl req -x509 -new -nodes -key ~/ssl/rootCA.key -sha256 -days 1024 -out ~/ssl/rootCA.pem |
<?php | |
/** | |
* Example useage: | |
* | |
* maybe_sideload_image( 'https://dummyimage.com/600x400/000/fff.png' ); // Downloads image to the media library and returns an attachment ID | |
* maybe_sideload_image( 'https://dummyimage.com/600x400/000/fff.png' ); // Returns an attachment ID as the image has already been downloaded and added to the media library | |
*/ | |
/** |