Skip to content

Instantly share code, notes, and snippets.

# ignore everything in this directory
/*
# but not these
!.gitignore
!assets/
!core/
!_SASS/
!_JS/
@mrhaw
mrhaw / Move Database Files.sql
Created May 14, 2021 07:33 — forked from FlogDonkey/Move Database Files.sql
For moving Database Files off of C: drive. Accepts a single Database, or runs for *all* databases. In testing, it took about one minute for each GB of DB size, so plan accordingly accordingly. There is a list of excluded databases, allowing you to precisely target databases.
DECLARE @WorkingSQL VARCHAR(8000)
,@NewPath VARCHAR(8000) = 'G:\SQL Data\' /* Root location to move files */
,@TargetDatabase sysname = '%'; /* Specify a singular database, or % for All Databases */
SET NOCOUNT ON;
/* Sanitize path */
IF RIGHT(@NewPath, 1) <> '\'
BEGIN
SET @NewPath = @NewPath + '\';

Keybase proof

I hereby claim:

  • I am mrhaw on github.
  • I am mrhaw (https://keybase.io/mrhaw) on keybase.
  • I have a public key ASCytruHC3Sj4FibQatiMmwMURntZEvyFnPKMbNsKPTu6wo

To claim this, I am signing this object:

<?php
$output = '';
function isValidZipCode($zipCode) {
return (preg_match('/^[0-9]{5}(-[0-9]{4})?$/', $zipCode)) ? true : false;
}
//$format = !empty($format) ? '?output='.urlencode(trim($format)) : '?output=text';
$address = !empty($address) ? '&addr='.urlencode(trim($address)) : '&addr=';
$city = !empty($city) ? '&city='.urlencode(trim($city)) : '&city=';
@mrhaw
mrhaw / svg2png.js
Created August 4, 2017 07:07 — forked from gustavohenke/svg2png.js
SVG to PNG
var svg = document.querySelector( "svg" );
var svgData = new XMLSerializer().serializeToString( svg );
var canvas = document.createElement( "canvas" );
var ctx = canvas.getContext( "2d" );
var img = document.createElement( "img" );
img.setAttribute( "src", "data:image/svg+xml;base64," + btoa( svgData ) );
img.onload = function() {
@mrhaw
mrhaw / plugin.php
Created June 26, 2017 00:23 — forked from rtripault/plugin.php
Sample plugin to display the welcome screen to any new member login for the first time in MODX Revolution manager
<?php
/**
* A sample plugin to display the "welcome message" to all users, login for the first time in Revo manager
*
* @var modX $modx
* @var array $scriptProperties
* @var modPlugin $this
*
* @see modPlugin::process()
*
@mrhaw
mrhaw / Messages
Created March 21, 2017 21:17
Dashboard Widget to display the number of internal Manager messages the user has - MODX Revoluition
// Dashboard widget to show number of Manager messages
$id = $modx->user->get('id');
$output = 'No messages.';
$total = $modx->getCount('modUserMessage',array(
'recipient' => $id,
));
if($total) {
$output = 'You have ' . $total . ' messages';
$unread = $modx->getCount('modUserMessage',array(
'recipient' => $id,
@mrhaw
mrhaw / gitclean.sh
Created June 13, 2016 23:09 — forked from ericelliott/gitclean.sh
gitclean.sh - cleans merged/stale branches from origin
git remote prune origin
git branch -r --merged master | egrep -iv '(master|develop)' | sed 's/origin\///g' | xargs -n 1 git push --delete origin
@mrhaw
mrhaw / gist:ceb7d666f6a8018a2416
Last active September 4, 2015 05:17 — forked from calkan/gist:eaad0bc4458da16a72dd
Michael Hoffman's crazy bash_history backer upper on git
1 - Create a *private* GitHub/Bitbucket or similar git repo. Here I assume the repo is:
https://github.com/calkan/bash_history.git
2 - Create .history directory and initialize it for the repo:
mkdir $HOME/.history
cd $HOME/.history
git init
touch README.md
/*==================================================
= Bootstrap 3 Media Queries =
==================================================*/
/*========== Mobile First Method ==========*/
/* Custom, iPhone Retina */
@media only screen and (min-width : 320px) {
}