Skip to content

Instantly share code, notes, and snippets.

<VirtualHost *:80>
ServerName stoydash.localhost
DocumentRoot "c:/wamp64/www/stoydash/"
<Directory "c:/wamp64/www/stoydash/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
@wisecrab
wisecrab / tracking-codes.md
Last active July 23, 2016 17:35
Tracking Code Placement

#Tracking Codes A simple list of common tracking codes and where to place them on your website.

Google Analytics

Pages

  • All

Placement

  • Before closing </head> tag
@wisecrab
wisecrab / read_more_functions.js
Created June 13, 2016 15:34
A simple script to add an expanding "read more" button to your page content on WordPress using a shortcode.
/**************************************************
>> Read More Shortcode <<
**************************************************/
jQuery(document).ready(function() {
//Set the content area as a variable
var moreContent = jQuery('.read_more_content');
//Auto hide the hidden content by default
moreContent.slideUp();
@wisecrab
wisecrab / state_name_to_abbreviation.php
Last active March 21, 2016 23:08
Easily convert a state name to the state abbreviation.
<?php
function convert_state_to_abbreviation($state) {
//If there is no text in the $state variable
if($state == '') {
//Exit this function
return false;
}
//Array of state names & abbreviations
@wisecrab
wisecrab / useful-linux-commands.txt
Last active February 17, 2016 13:56
A collection of useful terminal commands to use in linux.
//Check if packages are installed
dpkg --get-selections | grep [package_name]
//Show a list of files and directories in the current directory.
ls
//Show file permissions
ls -l /avr/www/html/index.php
//Edit a file
<?php
function checkForRedirects($URL) {
$ch = curl_init($URL);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_exec($ch);
$original_status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
@wisecrab
wisecrab / prepare-url.php
Created December 21, 2015 18:50
Simple function to prepare URL's with either http or https
<?php
function prepare_url($string) {
//Check if the string starts with http or https
if (substr($string, 0, 7) == "http://" OR substr($string, 0, 8) == "https://") {
$url = $string;
} else {
//Remove any presence of http:// or https:// from the link
$string = str_replace("://", "", $string);
@wisecrab
wisecrab / wordpress-add-term-meta.php
Last active December 24, 2015 17:18
Term Meta in WordPress 4.4
<?php
/*
The functions below will work in wordpress 4.4 and greater.
These functions allow you to add, get, and update meta data for terms/taxonomies.
*/
/*
*** Add Meta Data To A Term
//echo the current filename
echo basename(__FILE__);
//echo current filename without extension
echo basename(__FILE__, '.php');
//Echo the current URL
echo "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";