Skip to content

Instantly share code, notes, and snippets.

View jbokhari's full-sized avatar

jbokhari

View GitHub Profile
<?php
function print_x( $var, $return = false, $die = false ){
$html = "<pre class='print-x print-pre'>";
$html .= print_r($var, true);
$html .= "</pre>";
if ($return)
return $html;
else
echo $html;
/*
Min Heap
*/
/**
0
1 2
3 4 5 6
7 8 9 0 1 2 3 4
**/
a
@jbokhari
jbokhari / sublime-regex-cheat-sheet.txt
Created January 17, 2017 23:50
Sublime Text Regex Cheat Sheet
# Find, select or remove style attributes
\sstyle='[^']*'|\sstyle="[^"]*"
@jbokhari
jbokhari / .bash_profile
Created November 8, 2016 23:52
A simple bash_profile
export PATH=/bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:$PATH
export PATH=/Applications/MAMP/bin/php/php5.6.27/bin:$PATH
#export PATH=/usr/local/mysql/bin:$PATH
export EDITOR='subl -w'
magentoThing(){
php -d memory_limit=4096M -d max_execution_time=600 bin/magento $1
}
alias mage=magentoThing
@jbokhari
jbokhari / backup.php
Last active October 24, 2016 16:53 — forked from menzerath/backup.php
PHP: Recursively Backup Files & Folders to ZIP-File
<?php
/*
* PHP: Recursively Backup Files & Folders to ZIP-File
* DORKED FROM : (c) 2012-2014: Marvin Menzerath - http://menzerath.eu
* Dorked cause that ish was broken, some variables didn't even exist and no errors were reported.
*/
// Make sure the script can handle large folders/files
ini_set('max_execution_time', 3600);
ini_set('memory_limit','1024M');
<?php
/*
Plugin Name: Custom Shipping Methods
Plugin URI: http://woothemes.com/woocommerce
Description: Adds hard-coded custom shipping methods. Adds: Express Mail Flat Rate | FedEx Ground (Domestic Only) | Fedex Overnight Domestic | International FedEx | International Shipping USPS.
Version: 1.0.0
Author: Jameel Bokhari
Author URI: http://www.anchorwave.com
*/
<?php
/**
* Plugin Name: Youtube Vdieo From URL Shortcode
* Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
* Description: Displays embed code from GET var in url (EG example.com/?video=<strong>[videoid]</strong>) where videoid is the youtube id found in the url, embed code, etc., e/g/, youtube.com/embed/<strong>[videoid]</strong>. Use <code>[youtube-video]</code> shortcode in posts, pages and templates.
* Version: 0.0.0
* Author: Anchorwave
* Author URI: http://www.anchorwave.com/
* License: A short license name. Example: GPL2
*/
@jbokhari
jbokhari / hosts
Last active August 29, 2015 14:13
Direct http://dev/ to local website (using WAMP, etc)
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
@jbokhari
jbokhari / site-launch-settings.htaccess
Last active August 29, 2015 14:13
Enable GZIP and set Memory/Upload Limit
# Redirect test link to live site (Change example\.com to domain\.com, website\.org, etc.)
# Also forces exaple.com to www.example.com
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
</IfModule>
# Note: The above code block must be placed before WordPress' generated permalink code
# BEGIN WordPress
(function($, document){
var tabbed = $(".tabbed");
var tab = $(".tab", tabbed);
var tabbedFirst = tabbed.eq(0);
tabbed.not(tabbedFirst).each(function(){
$this = $(this);
// console.log(tabbed);
$this.find('.tab-content').appendTo(tabbedFirst.find('.entry-content')).hide();
$this.find('.tabs .tab').appendTo(tabbedFirst.find('.tabs')).addClass("inactive");