Skip to content

Instantly share code, notes, and snippets.

View logichub's full-sized avatar

Kashif Rafique logichub

View GitHub Profile
@jdevalk
jdevalk / .htaccess
Last active January 7, 2025 07:26
These three files together form an affiliate link redirect script.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index\.php$ - [L]
RewriteRule (.*) ./index.php?id=$1 [L]
</IfModule>
@jasperf
jasperf / php-chmod
Created June 11, 2013 10:05
PHP Script to change file and folder permissions See http://www.webhostingtalk.com/showthread.php?t=218863 #PHP #permissions #chmod
<?php
//http://www.webhostingtalk.com/showthread.php?t=218863
$start_dir = 'whatever'; // Starting directory no trailing slashes.
$perms['file'] = 0644; // chmod value for files don't enclose value in quotes.
$perms['folder'] = 0755; // chmod value for folders don't enclose value in quotes.
function chmod_file_folder($dir) {
global $perms;
$dh=@opendir($dir);
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 5, 2025 13:05
A badass list of frontend development resources I collected over time.
@franz-josef-kaiser
franz-josef-kaiser / wpmail_exceptions.php
Last active May 28, 2024 07:30
WP Mail Error/Exception handling and SMTP settings
<?php
defined( 'ABSPATH' ) OR exit;
/**
* Plugin Name: (WCM) PHPMailer Exceptions & SMTP
* Description: WordPress by default returns <code>FALSE</code> instead of an <code>Exception</code>. This plugin fixes that.
*/
add_action( 'phpmailer_init', 'WCMphpmailerException' );
function WCMphpmailerException( $phpmailer )
{
@pippinsplugins
pippinsplugins / gist:5861915
Created June 25, 2013 20:09
Replace EDD country / state drop downs with plain text fields.
<?php
function pw_edd_remove_default_fields() {
remove_action( 'edd_after_cc_fields', 'edd_default_cc_address_fields' );
}
add_action( 'init', 'pw_edd_remove_default_fields' );
function pw_edd_custom_country_fields() {
ob_start(); ?>
<fieldset id="edd_cc_address" class="cc-address">
@headquarters
headquarters / find-oversized-element.js
Last active December 28, 2018 13:58
Find the offending element causing a horizontal scrollbar at any screen width (requires jQuery).
var screenWidth = window.innerWidth;
var visibleElements = jQuery(":visible");
visibleElements.each(function(){
var $this = jQuery(this);
if($this.width() > screenWidth){
$this.css("border", "1px solid green");
console.log("Screen width is " + screenWidth + " and the following element is " + $this.width(), $this);
}
});
@pippinsplugins
pippinsplugins / gist:5896919
Created June 30, 2013 21:13
Simple PHP object to array conversion.
If $foo is an object such as:
`
stdClass Object
(
[something] => 279
[something_2] => 1
)
`
@mathetos
mathetos / Deregister This
Created July 9, 2013 22:03
How do I deregister the RevSlider?
<?php
$slider = new RevSlider();
$arrSliders = $slider->getArrSliders();
$addNewLink = self::getViewUrl(RevSliderAdmin::VIEW_SLIDER);
require self::getPathTemplate("sliders");
?>
@corsonr
corsonr / gist:6138666
Created August 2, 2013 09:31
WooCommerce - List products by attribute (multiple values), ex: [woo_products_by_attributes attribute="colour" values="red,black" per_page="5"]
<?php
/**
* Plugin Name: WooCommerce - List Products by Attributes
* Plugin URI: http://www.remicorson.com/list-woocommerce-products-by-attributes/
* Description: List WooCommerce products by attributes using a shortcode, ex: [woo_products_by_attributes attribute="colour" values="red,black" per_page="5"]
* Version: 1.0
* Author: Remi Corson
* Author URI: http://remicorson.com
* Requires at least: 3.5
* Tested up to: 3.5
@zanematthew
zanematthew / bootstrap.sh
Last active December 1, 2019 17:33
My shell script for creating a Vagrant 64bit development server
#!/usr/bin/env bash
echo "Running boostrap.sh..."
echo "+---------------------------------------------------+"
echo "| Update apt-get |"
echo "+---------------------------------------------------+"
apt-get update