Skip to content

Instantly share code, notes, and snippets.

View zeshanshani's full-sized avatar
🎯
Focusing

Zeshan Ahmed zeshanshani

🎯
Focusing
View GitHub Profile
@zeshanshani
zeshanshani / fixFooterToBottom.js
Last active March 9, 2019 08:16
This script makes sure the footer always remain to the bottom of the page. It is best in situations where page's content is less and footer doesn't stick to the bottom of the page. It works by adding a min-height property to the main content of the p
/**
* Fix Footer to the Bottom of The Page
*
* This script makes sure the footer always remain to the bottom
* of the page. It works by adding a min-height property to the
* content of the page.
*
* Variables:
*
* $main = main content area on which the height will be applied
@zeshanshani
zeshanshani / troubleshooting.md
Created October 20, 2018 11:22 — forked from adamwathan/troubleshooting.md
Troubleshooting Valet on macOS Sierra

Troubleshooting Valet on Sierra

Common Problems

Problem: I just see "It works!"

Apache is running on port 80 and interfering with Valet.

  1. Stop Apache: sudo /usr/sbin/apachectl stop
  2. Restart Valet: valet restart
@zeshanshani
zeshanshani / custom-nav-walker.php
Last active September 2, 2018 12:22
Custom WP Nav Walker class.
<?php
if ( class_exists( 'Rarus_Nav_Walker' ) ):
class Rarus_Nav_Walker extends Walker_Nav_Menu {
private $cur_item;
/**
* Start Level
@zeshanshani
zeshanshani / wc-product-slider-vertical-styling.css
Last active April 17, 2019 22:34
WooCommerce Product Slider Vertical Styling. The CSS code will make your slider vertical aligned. This code will enable product gallery slider: https://gist.github.com/zeshanshani/5e634af86e49ce07c87b44728c62f64b
/* ==================================== */
/* WooCommerce Product Image Slider */
/* This code will enable product gallery slider: */
/* gist.github.com/zeshanshani/5e634af86e49ce07c87b44728c62f64b */
/* ==================================== */
.woocommerce .woocommerce-product-gallery.woocommerce-product-gallery--with-images {
padding-left: 115px;
box-sizing: border-box;
position: relative;
#!/bin/bash
USER="root"
PASSWORD=""
FILES="/Users/tenold/Backups/MySQL/*"
for f in $FILES
do
echo "Processing $f file..."
@zeshanshani
zeshanshani / dump.sh
Created February 12, 2018 20:39 — forked from andsens/dump.sh
Backup all MySQL databases into separate files
#!/bin/sh
## backup each mysql db into a different file, rather than one big file
## as with --all-databases. This will make restores easier.
## To backup a single database simply add the db name as a parameter (or multiple dbs)
## Putting the script in /var/backups/mysql seems sensible... on a debian machine that is
## Create the user and directories
# mkdir -p /var/backups/mysql/databases
# useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup
## Remember to make the script executable, and unreadable by others
@zeshanshani
zeshanshani / php-rewrite-rule-fix-for-same-slug.php
Last active March 6, 2019 17:52
Fix pagination of page with same slug as of CPT's rewrite slug. This function will fix the same slug conflict of CPT and a static page with pagination.
<?php // Don't copy this line...
/**
* This function will Kill 'blogs/editor' rewrite rules
* to fix the broken pagination issue on this page:
* '/blogs/editor/'
*
* This fix was needed because we add rewrite rules for CPT: editor
* And because '/blogs/editor/' is also a static page, the pagination
* on that page e.g., '/blogs/editor/page/4/' was broken.
<?php // please don't copy this line.
/**
* Get SERP Name
*/
function jiv_get_serp_name() {
if ( isset( $_SERVER['HTTP_REFERER'] ) ) {
$serps = array( 'google', 'bing', 'yahoo', 'duckduckgo' );
$referer = $_SERVER['HTTP_REFERER'];
$result = jiv_get_domain_from_url( $referer );
<?php
/**
* Get Full Customer Name from Order ID
*
* Author: Zeshan Ahmed
* Author URI: https://zeshanahmed.com/
*/
function za_full_customer_name( $order_id ) {
@zeshanshani
zeshanshani / html.json
Last active September 21, 2020 12:44
Expand PHP conditionals in HTML in VS Code.
{
// ECHO
"PHP Echo Tag": {
"prefix": "echo",
"body": [
"<?php echo ${1:\\$var}; ?>"
],
"description": "Expand \"echo\" into PHP echo block"
},