How to Back up Your Database on Vagrant Halt

I’ve been exploring Vagrant lately. At work we need a better development workflow, and at home I’ve been reaping the benefits as well. One of the nice aspects of Vagrant is the ephemeral nature it gives to your environment. You can spin up a development box quickly and easily with a single command vagrant up when you’re not working you can halt the virtual machine with vagrant halt and when you’re not working on the project you can destroy the virtual machine and clear up your resources with vagrant destroy.

Continue reading...

Proof of Concept: I made my very own Foursquare (Swarm) on WordPress… and you can too.

I”ve always loved the concept of Foursquare. Sharing locations is awesome, although somewhat creepy. How do you leverage the awesomeness while avoiding the creepy factor? Sadly today it’s basically impossible to protect yourself against being tracked, if you have a mobile phone. But I’m not going to give away my apartment key to everyone around, just because it’s possible to pick the lock. My biggest gripe against Foursquare is that it’s all real-time, so I couldn’t control when I was posting my location.

Continue reading...

How to use JSONP (AJAX to SSL) in WordPress, an EASIER way

I’ve already written about How to use JSONP in WordPress Development. I explain how it works, and why you would use it there. At work we work with several domains and I’ve had to use quite a bit of JSONP, I’ve rethought how to use it, and made this micro-framework to make it a LOT easier. Mostly, I wrote this to solve the problem that I’m using a lot of AJAX, and don’t want the overhead of the .

Continue reading...

How to Write a CSV Directly to PHP://Output I/O Buffer With fputcsv()

Came across this gem half-way down the function page for fputcsv() on php.net // Send headers for file header( 'Content-Type: text/csv' ); header( 'Content-Disposition: attachment;filename='.$filename); // open buffer to write file to browser $fp = fopen('php://output', 'w'); // Table Headings row fputcsv($fp, array_keys($row)); // Write rows to buffer while($row = mysql_fetch_assoc($result)) { fputcsv($fp, $row); } Use an associative array for this so your keys will be the csv headers.

Continue reading...