Skip to content

Instantly share code, notes, and snippets.

View trey's full-sized avatar
🏠
I'd rather be at home

Trey Piepmeier trey

🏠
I'd rather be at home
View GitHub Profile
@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
}
#! /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 / YQL
Created November 7, 2009 07:42
How beards.trey.cc works. Be sure to note the YQL snippet at the bottom. Make your own at http://developer.yahoo.com/yql/console/
use 'http://yqlblog.net/samples/data.html.cssselect.xml' as data.html.cssselect; select * from data.html.cssselect where url="http://whiskerino.org/2009/beards/trey/favorites/" and css="#gallerywidemouth div"
@trey
trey / treyvhost
Created February 1, 2010 21:06
Create a new project based on my site-template project.
#!/bin/sh
# Original script by Jason Tan: http://solutions.treypiepmeier.com/2009/03/03/virtual-hosts-on-osx-leopard/#comment-41787
DIR=/Users/$SUDO_USER/Sites/$1
if [[ ! -d $DIR && `id -u` -eq 0 ]]; then
echo ""
echo "Downloading site-template repository ..."
sudo -u $SUDO_USER git clone --quiet git://github.com/trey/site-template.git $DIR
cd $DIR

Django Enviroment Setup on Mac OSX 10.6.2 (Snow Leopard)

Install Homebrew

sudo mkdir /usr/local
sudo chown -R `whoami` /usr/local
curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local
brew install git
cd /usr/local
git init
@trey
trey / requirements.txt
Created March 5, 2010 04:53
PIP requirements file for ComicBinder
docutils==0.6
django-tagging
sorl-thumbnail
django-gravatar
django-debug-toolbar
PIL
-e hg+http://bitbucket.org/ubernostrum/django-registration/#egg=Registration
-e git://github.com/mintchaos/typogrify.git#egg=Typogrify
-e git://github.com/simonw/django-html.git#egg=django_html
-e svn+http://code.djangoproject.com/svn/django/trunk#egg=Django
@trey
trey / wp-config.php
Created March 8, 2010 21:16
Flexible WordPress Configuration
define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/wp-content' );
define('WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/wp-content');
define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME'] . '');
define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/wordpress');
/* More info: http://solutions.treypiepmeier.com/2008/05/28/installing-wordpress-the-right-way/ */
@trey
trey / FormFanciness.css
Created December 3, 2010 00:47
Some nice basic text input and textarea styling
input[type=text],
textarea { padding: 7px 5px 7px 8px; border: 1px solid #999; }
input[type=text]:focus,
textarea:focus { border-color: #000; border-color: #000; border-width: 1px; border-left-width: 3px; padding-left: 6px; }
input[type=text] { width: 300px; }
input.error,
input.error:focus,
textarea.error,
textarea.error:focus { border-color: red; }
label { display: block; margin: 10px 0 0; font-weight: bold; font-size: 13px;}
@wyattdanger
wyattdanger / base.sh
Created December 13, 2010 16:41 — forked from jamessanders/base.sh
# change directory to the base of your project
# Your project base is the directory that contains
# either _darcs or .git or .hg
# to use as a command add to .zshrc or .bashrc
# alias base='source <path/to/base.sh>
CUR=$(pwd);
while [ ! "$CUR" = "/" ]
@trey
trey / mixins.sass
Created December 28, 2010 22:53
Clever Sass Mixins
// @include rounded(25px)
@mixin rounded($radius)
-webkit-border-radius: $radius
-moz-border-radius: $radius
border-radius: $radius
@mixin rounded-tl($radius)
-moz-border-radius-topleft: $radius
-webkit-border-top-left-radius: $radius
border-top-left-radius: $radius