This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
echo. > errors.log |
<?php | |
# When using the Zend View URL helper to generate URLs to controller actions, | |
# rather than named routes, you have to use 'default' as the route name. | |
# Generating a URL for the `bar` action in the `foo` controller. | |
echo $this->url(array('action' => 'bar', 'controller' => 'foo'), 'default', true); | |
# And NOT this as most people seem to assume (self included). |
USE db2; | |
CREATE TABLE table2 LIKE db1.table1; | |
INSERT INTO table2 | |
SELECT * FROM db1.table1; |
mysqldump -u(username) -p(password) (source database name) (table names...) | mysql -u(username) -p(password) (destination database name) |
mysqldump -u username -p --default-character-set=latin1 -N database > backup.sql | |
mysql -u username -p --default-character-set=latin1 database < backup.sql |
SELECT `field` FROM `table` GROUP BY `field` HAVING count(field) > 1; | |
-- Find duplicated values for the column `field` |
#!/bin/sh | |
# the name of your Wireless interface. Might be en1 on some machines. | |
AIRPORT="en0" | |
# name of the wifi network | |
WIFI_WORK="<name-of-your-office-wifi>"; | |
if networksetup -getairportnetwork $AIRPORT | grep -i -a $WIFI_WORK ; | |
then |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
server { | |
index index.php; | |
set $basepath "/var/www"; | |
set $domain $host; | |
# check one name domain for simple application | |
if ($domain ~ "^(.[^.]*)\.dev$") { | |
set $domain $1; | |
set $rootpath "${domain}"; |
<?php | |
// add this to your php.ini | |
// auto_prepend_file = /path/to/virtual.prepend.php | |
$http_host = explode('.',$_SERVER['HTTP_HOST']); | |
$__mod_vhost_alias_fix_doc_root = $_SERVER['DOCUMENT_ROOT'] . | |
DIRECTORY_SEPARATOR . $http_host[0] . | |
DIRECTORY_SEPARATOR . 'public'; | |
if (is_dir($__mod_vhost_alias_fix_doc_root)) { |