Skip to content

Instantly share code, notes, and snippets.

adrienne / alt-handy-utilities.php
Created Aug 19, 2010
Some handy PHP utilities that I keep using
View alt-handy-utilities.php
/* === quick & dirty PHP pretty-printer for arrays ========================================================== */
function pp($arr){
$retStr = "<dl>\n";
if (is_array($arr)){
foreach ($arr as $key=>$val){
if (is_array($val)){
$retStr .= "<dt>" . $key . " => </dt>\n<dd>" . pp($val) . "</dd>\n";
adrienne / LICENSE.txt
Created Jun 13, 2011 — forked from 140bytes/LICENSE.txt -- Click ↑↑ fork ↑↑ to play!
View LICENSE.txt
Version 2, December 2004
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
adrienne / adrienne-utilities.htaccess
Created Oct 4, 2011
A handy set of .htaccess declarations that I can pick and choose from for various projects
View adrienne-utilities.htaccess
SetEnv APPLICATION_ENV development
SetEnv DEBUG_FIREPHP enabled
# Access in PHP:
# // Define application environment
# defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
# // Enable FirePHP for testing?
# defined('DEBUG_FIREPHP') || define('DEBUG_FIREPHP', (getenv('DEBUG_FIREPHP') ? getenv('DEBUG_FIREPHP') : 'disabled'));
Options All -Indexes
Options +FollowSymLinks
View private-dns-masking.markdown

Private DNS Masking

Using Apache Virtual Hosts and mod_proxy for Fun & Profit

So I realized the other day that I was typing the same URLs about a zillion times a day. Even with address bar completion in Firefox and/or Chrome, there is still a lot of wasted effort trying to get to a given site. (URL completion doesn't help much when one of your sites is and another is, for example.)

What I wanted was to be able to type in, say, and have my system just know that that actually meant I wanted to go to my ThingOne development site. I knew of a lot of ways to do part of that, but no way to solve the whole problem.

Then, in a fit of serendipity (and research), I hit upon this technique!

Note that the directions below presuppose a fair level of comfort with your operating system. I've tried to make the directions clear, and gone into a lot of detail about (lik

adrienne / condcomments.txt
Created Dec 19, 2011
Conditional Comments (for reference)
View condcomments.txt
<!--[if IE 7]>
<!--[if gte IE 8]>
IE8 or better
<!--[if !IE]><!-->
You are NOT using Internet Explorer
adrienne / count_entries.ee_snip.sql
Created Jan 3, 2012
ExpressionEngine query: count entries
View count_entries.ee_snip.sql
SUM(entries) AS alltime,
SUM(IF((YEAR(entrydate) = YEAR(CURDATE())),entries,0)) AS thisyear,
SUM(IF((MONTH(entrydate) = MONTH(CURDATE()) && YEAR(entrydate) = YEAR(CURDATE())),entries,0)) AS thismonth,
SUM(IF((WEEKOFYEAR(entrydate) = WEEKOFYEAR(CURDATE()) && YEAR(entrydate) = YEAR(CURDATE())),entries,0)) AS thisweek,
SUM(IF((DAYOFYEAR(entrydate) = DAYOFYEAR(CURDATE()) && YEAR(entrydate) = YEAR(CURDATE())),entries,0)) AS thisday
DATE(FROM_UNIXTIME(entry_date)) AS entrydate,
COUNT(entry_id) AS entries
adrienne /
Created Jan 5, 2012
Use cURL to get a remote file into an editor (originally from here:
if [[ ! "$1" || "$1" == "-h" || "$1" == "--help" ]]; then cat <<HELP
Curl a remote file into an editor.
echo "Usage: $(basename "$0") [curloptions...] url"
Curl a remote file into the editor of your choice. The filename will be based
on the URL's filename. If a file extension can't be determined from the URL,
View blankjquerybookmarklet.js
// the minimum version of jQuery we want
var v = "1.71";
// check prior inclusion and version
if (window.jQuery === undefined || window.jQuery.fn.jquery < v) {
var done = false;
var script = document.createElement("script");
script.src = "" + v + "/jquery.min.js";
adrienne / NerderyVPN.bat
Created May 23, 2012
A batch file to connect to the VPN and mount the network storage as a drive
View NerderyVPN.bat
@echo off
if exist n:\home goto DISCONNECTME else goto CONNECTME
REM NOTE: in all of the below variables EXCEPT for mydrivename , double-quote the values!
REM This is the name of the VPN you've got set up
set myvpnname="Name of your VPN connection"