Skip to content

Instantly share code, notes, and snippets.

View trey's full-sized avatar
🐢
Slow and steady

Trey Piepmeier trey

🐢
Slow and steady
View GitHub Profile
#!/bin/bash
#
# Save in your .bash_profile then: isreg domain.com
function isreg {
dig soa $1 | grep -q ^$1 && echo "Yes" || echo "No"
}
#! /usr/bin/env ruby
#
# Save in your path as "isreg" and chmod +x. Then: isreg domain.com
#
puts `whois #{ARGV[0]}` =~ /No match for \"#{ARGV[0]}\"/mi ? "No" : "Yes"
@trey
trey / gist:134595
Created June 23, 2009 15:32
Hostname switching in PHP, Python, and Ruby
$localServers = array('something.dev');
$stagingServers = array('something_else.com', 'and_another.com');
if (in_array($_SERVER['HTTP_HOST'], $localServers)) {
// Development settings
} elseif (in_array($_SERVER['HTTP_HOST'], $stagingServers)) {
// Staging settings
} else {
// Production settings
}