Skip to content

Instantly share code, notes, and snippets.

@oranblackwell
oranblackwell / array_insert_into_middle.php
Last active December 31, 2015 05:49
Replace value within an array with multiple new values while keeping the numerical order AKA insert/replace into the middle of array.
<?php
/**
* replace value within an array with multiple new values while keeping the numerical order
* AKA insert/replace into the middle of array
*
* @param $parentArray
* @param int $numericalKey the key of the element to be removed
*/
$parentArray = array(0,1,2,3,4,5,6,7,8,9);
@oranblackwell
oranblackwell / DirectoryListingVariations
Created December 6, 2013 10:48
Various combinations of storing directories and files in a text file in a combination of structures. PC.
# flat directory/file listings
"dir > top-level-folders.txt"
"dir /s > dir.txt" same as above but recursive
"dir /s /w > dir.txt" to get rid of time and date info, etc
# Directory Tree
# /A adjusts the visual tree - adds + and -, and \ for last parent of each level
tree /A > just-folder-structure.txt
tree /A /F > file-and-folder-structure.txt
@oranblackwell
oranblackwell / Custom Analytics Tracking (config'd for WP)
Created December 6, 2013 10:14
Last edited 2011 WP functions needed. Pass to _gaq by setting _setCustomerVar.
//header.php version - Place just before </head>
##########################################
<?php
require_once($CFG->dirroot.'/blocks/sb_training_tools/lib/locallib.php');
require_once($CFG->dirroot.'/user/profile/lib.php');
/**
*
* Retrieve the displayed user's details
*/
@oranblackwell
oranblackwell / buttonLibrary.md
Last active December 30, 2015 00:49
Cross Browser (maximum legacy support -IE6+ and fallback) buttons with background-gradients, broder-radius and box-sizing