Skip to content

Instantly share code, notes, and snippets.

View drawcard's full-sized avatar
👍

Drawcard drawcard

👍
  • Drawcard
  • Australia
View GitHub Profile
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@luetkemj
luetkemj / wp-query-ref.php
Last active April 25, 2024 09:37
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@barraponto
barraponto / git-submodule-rm.sh
Created April 25, 2012 16:36
git submodule-rm
#!/bin/bash
function actual_path() {
if [ [ -z "$1" ] -a [ -d $1 ] ]; then
echo $(cd $1 && test `pwd` = `pwd -P`)
return 0
else
return 1
fi
}
@fideloper
fideloper / usevm.md
Created June 6, 2012 02:24
You should develop in a Virtual Machine

#You should do all your LAMP development in a Virtual Machine

##Here's Why:

Many of us develop on Macintoshes. There are many reasons for this, but one of them is that it's based on a Unix platform of some sort. This allows us to run common server software such as Apache, Ruby, Python and Nodejs on our Macs.

Our computers become powerful develoment machines similar to the servers our apps will eventually live on.

Sometime we start our computer only to find Apache won't start, or MySQL can't create a PID file, or we've updated to Mountain Lion and Apache needs to be reconfigured. Death!

@thegdshop
thegdshop / gist:3171026
Created July 24, 2012 16:28
WooCommerce - Add checkbox field to the checkout
<?php
/**
* Add checkbox field to the checkout
**/
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field');
function my_custom_checkout_field( $checkout ) {
echo '<div id="my-new-field"><h3>'.__('My Checkbox: ').'</h3>';
@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@byjamaljama
byjamaljama / wp_hook_inspector.php
Last active August 9, 2021 21:30
WordPress Hook Inspector: Inspects which functions are attached into what hook.
<?php
/**
* Plugin Name: WordPress Hook Inspector
* Description: Provides a shortcode that displays information table about which function is hooked into what hook. The information displayed is only for debugging and the shortcode will not display anything if the post included is not password protected. <strong>Usage:</strong> add [inspect hook="hook_name"] for single hooks or [inspect] for all hooks. The shortcode requires the post to be password protected.
* Author: JML
* Author URI: http://jml.so
* Version: 1.0
* License: GNU General Public License v2.0
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
@vc27
vc27 / YoastSEOWPEdits
Last active June 19, 2019 09:15
Get rid of some annoying part of Yoast SEO for WordPress.
<?php
/**
* File Name: WPSEOEdits.php
* @package WordPress
* @subpackage ParentTheme_VC
* @license GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* @version: 0.1
* @updated: 10.07.12
**/
#################################################################################################### */
@AJ-Acevedo
AJ-Acevedo / admin-bar-fix.css
Last active April 25, 2017 00:39
WordPress 3.6 and Bootstrap 3 Admin bar overlap fix
// This fixes the WordPress admin-bar 28px overlap issue with Bootstrap 3.
body.admin-bar .navbar {
position:fixed;
top: 28px;
z-index: 1000;
height: 40px;
// If the above does not work try this if your nav is wrapped in .header
@joshuaswilcox
joshuaswilcox / current_song
Last active September 2, 2023 14:12
Applescript to show current playing song and determine if its spottily or iTunes that is playing
if application "Spotify" is running and application "iTunes" is not running then
tell application "Spotify"
if player state is stopped then
set display to "No Track Playing"
else
set track_artist to artist of current track
set track_name to name of current track
set track_duration to duration of current track
set seconds_played to player position
set state to ""