Skip to content

Instantly share code, notes, and snippets.

View bdw-ext-config.json
{
"info": {
"name": "BDWebs WHMCS",
"version": "1.0.0",
"download_link": "https://github.com/appsforbd/bdwebs-whmcs-monitoring/releases/latest"
},
"links": [
{
"title": "BDWebs.com",
"link": "https://www.bdwebs.com/"
@sobujbd
sobujbd / Mark parent navigation active when on custom post type single page Mark (highlight) custom post type parent as active item in Wordpress Navigation.When you visit a custom post type's single page, the parent menu item (the post type archive) isn't marked as active. This code solves it by comparing the slug of the current post type with the navigation items, and adds a class accordingly.
View Mark parent navigation active when on custom post type single page
<?php
function add_current_nav_class($classes, $item) {
// Getting the current post details
global $post;
// Get post ID, if nothing found set to NULL
$id = ( isset( $post->ID ) ? get_the_ID() : NULL );
@sobujbd
sobujbd / README.md
Created Jul 16, 2020 — forked from mbleigh/README.md
Firebase Hosting Fetch All Files
View README.md

Fetch All Files from Firebase Hosting

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.

Running via NPX

npx https://gist.github.com/mbleigh/9c8680cf319ace2f506f57380da66e7d <site_name>
@sobujbd
sobujbd / csv-to-json.php
Created Jul 30, 2019 — forked from robflaherty/csv-to-json.php
Convert CSV to JSON
View csv-to-json.php
<?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
@sobujbd
sobujbd / wpcli-wp-install.sh
Created Jul 25, 2019
One-Click WordPress Installer
View wpcli-wp-install.sh
#!/bin/bash
# Setup Variables
DBNAME=database_name
DBUSER=database_user
DBPASS=database_password
#DBHOST=localhost
#DBPREFIX=gits_
URL=domain_name
@sobujbd
sobujbd / set-value.md
Created Jun 1, 2019 — forked from JeffreyWay/set-value.md
PHP: Set value if not exist
View set-value.md

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');
View wp-cli-create.sh
#!/bin/bash
# Setup Variables
DBNAME=dbname
DBUSER=dbuser
DBPASS=dbpass
DBHOST=localhost
DBPREFIX=oxo_
URL=http://
@sobujbd
sobujbd / wp_db_create_backup.sh
Created Apr 8, 2019 — forked from LostinOrchid/wp_db_create_backup.sh
Create database backup in Wordpress
View wp_db_create_backup.sh
#!/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
@sobujbd
sobujbd / batch image convert (imagemagick).sh
Created Mar 14, 2019
batch image convert (imagemagick)
View batch image convert (imagemagick).sh
#!/usr/bin/env bash
magick convert *.jpg -set filename:basename "%[basename]" "%[filename:basename].png"
@sobujbd
sobujbd / android-select-device.sh
Created Oct 15, 2018
Select Android Devices Serial for ADB
View android-select-device.sh
#!/bin/bash
# selects an android device
PROGNAME=$(basename $0)
UNAME=$(uname)
DEVICE_OPT=
for opt in "$@"
do
case "$opt" in