Skip to content

Instantly share code, notes, and snippets.

@joshuapaling
joshuapaling / getWeekEndpoints
Created July 12, 2013 05:27
I'm using this for a job, and I don't think I need it anymore - but I don't want to throw it out just yet either. Today is 12 Jul 2013, so in a few months if I haven't used it I can throw this out.
/**
* Takes a date and calculates the start and end of the calendar week that it's in.
* Start will be 00:00:00 of the Monday of that calendar week, and end will be
* 00:00:00 of the Monday of the next calendar week (ie, just after the Sunday ends)
*
* @param string $date MySQL friendly date, with format "Y-m-d H:i:s"
* @return array - has two keys, 'start' and 'end' which are the boundaries of the calendar
* week, in MySQL format - ie, "Y-m-d H:i:s"
*/
protected function _getWeekEndpoints($date){
@joshuapaling
joshuapaling / gist:5499915
Last active December 16, 2015 21:29
Wordpress config - live / local / staging database configs in the one file.
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
// ** MySQL settings - You can get this info from your web host ** //
switch ($_SERVER['SERVER_NAME']) {
case 'mysite.localhost':
define('DB_NAME', 'local_database_name');
# I battled for hours trying to install imagick via macports, trying to follow various tutorials.
# If you've been battling with macports, completely uninstall everything related to
# macports (http://guide.macports.org/chunked/installing.macports.uninstalling.html)
# and trying with Home Brew instead, using the instructions below
# install brew (http://mxcl.github.com/homebrew/)
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
# install imagemagick