Skip to content

Instantly share code, notes, and snippets.

@leighmcculloch
leighmcculloch / file_recursive.php
Last active September 27, 2015 03:08
PHP Recursive File/Directory Functions
function recursive_delete($dir) {
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::CHILD_FIRST);
foreach ($iterator as $file) {
$path = $file->__toString();
if($file->isDir()) {
rmdir($path);
} else {
unlink($path);
}
}
@leighmcculloch
leighmcculloch / mdig.rb
Created August 20, 2014 18:22
Multi-Region DNS Lookup Utility
# Multi-Region DNS NameServer Propogation Check
#
# Uses the dns-lg.com API to retrieve the NS records for a zone (domain name)
# at 19 (more or less) different locations globally. Use this to monitor the
# propogation of nameserver changes at your registrar.
#
# Note: There is no such thing as a guarantee when it comes to whether your
# new nameservers have propogated fully or not. Rule of thumb is three days
# but often it is much faster and this check can help you weigh the risks.