Skip to content

Instantly share code, notes, and snippets.


Ahmad Karim ahmu83

View GitHub Profile
ahmu83 / LocalValetDriver.php
Last active Feb 16, 2019
This is a valet driver which changes the root directory of a valet site using a file .rootdir which contains the directory and the entry file. i.e, /www/home.php
View LocalValetDriver.php
class LocalValetDriver extends LaravelValetDriver {
* Determine if the driver serves the request.
* @param string $sitePath
* @param string $siteName
* @param string $uri
ahmu83 / send-woocommerce-order-emails.php
Last active Oct 24, 2017
Send WooCommerce Order Emails Against an order id and email id
View send-woocommerce-order-emails.php
* Send WooCommerce order email(s)
* @param integer $order_id WooCommerce order id.
* @param string|array $email_id The id of the email or an array of the email ids that need to send.
* @return bool Type returned Will return true if the email id provided is sent successfully.
function send_wc_order_email($order_id, $email_id) {
ahmu83 / US_States_and_Cities.json
Created Jul 20, 2016
List of US States and Cities in JSON format.
View US_States_and_Cities.json
"New York": [
"New York",
"New Rochelle",
"Mount Vernon",
View gist:20e1a60add63bd7879de1da1f8c10c96
ahmu83 / print_are.php
Last active Mar 2, 2018
Pretty Version of PHP's print_r Function
View print_are.php
* A pretty version of "print_r" function
* @param Array|stdClass $obj
* @param string $title Optional.
* @param bool $collapse Optional.
* @return string Type returned.
View gist:8a069045e0f487c2a0fe
url: '/URL/',
type: 'POST', /* POST/GET */
dataType: 'json', /* xml/html/script/json/jsonp */
data: form_data,
crossDomain: true,
success: function(data, textStatus, xhr) {
/* success */
error: function(xhr, textStatus, errorThrown) {
ahmu83 / jQuery: preload an image
Created May 13, 2014
jQuery: preload an image
View jQuery: preload an image
var src = "",
img = $("<img />");
img.hide().attr("src", src);
img.load(function() {
// Image is loaded
View gist:11183021
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
ahmu83 / jQuery: add ie version number to HTML class attribute
Created Apr 22, 2014
jQuery: add ie version number to HTML class attribute
View jQuery: add ie version number to HTML class attribute
var version = jQuery.browser.version;
case "6.0":
jQuery("html").addClass("ie ie6 lte10 lte9 lte8 lte7");
case "7.0":
jQuery("html").addClass("ie ie7 lte10 lte9 lte8 lte7");
case "8.0":
You can’t perform that action at this time.