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 / mapOrder.js
Created May 2, 2019 21:30 — forked from ecarter/mapOrder.js
Order an array of objects based on another array order
/**
* Sort array of objects based on another array
*/
function mapOrder (array, order, key) {
array.sort( function (a, b) {
var A = a[key], B = b[key];
body .gform_wrapper .gform_footer {
padding-bottom: 0;
}
@media screen and (min-width: 768px) {
body .gform_wrapper .gform_footer {
text-align: right;
}
}
@zeshanshani
zeshanshani / imgPrint.js
Created March 12, 2019 09:24
This code prints an image on the page.
/**
* Image Sourec to Print
*
* Usage:
*
* imgPrint( $('img').attr('src') );
*
* @param {string} source source of the image
*/
function imgSourceToPrint( source ) {
@zeshanshani
zeshanshani / copy-to-clipboard.js
Created March 10, 2019 21:16
This function allows you to copy a string to the clipboard.
/**
* Copy Text to Clipboard
*
* Usage: simply pass the string to copyToClipboard() funciton and it will be
* copied to the clipboard
*
* Source: https://hackernoon.com/copying-text-to-clipboard-with-javascript-df4d4988697f
*/
function copyToClipboard( str ) {
const el = document.createElement('textarea'); // Create a <textarea> element
<?php // Do not copy this line.
/**
* Remove Script Version
*
* This function removes the query string from the scripts and styles.
*
* Author: Zeshan Ahmed
* Author URI: https://zeshanahmed.com/
*
@zeshanshani
zeshanshani / is_external.php
Created March 9, 2019 08:23
This function checks if the provided URL is of external site or not. Returns boolean.
<?php // do not copy this line.
/**
* Is External
*
* This function checks if the provided URL is external or not.
*
* Author URL: https://zeshanahmed.com/
*
@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;