Tuesday, January 10th, 2012
application/logs/*
!*.htaccess
That is all.
Tuesday, January 10th, 2012
That is all.
Friday, December 4th, 2009
So I’ve started on my new little project Proxie. In order for it to be scalable, I’ve started using Capistrano for the development and deployment processes. Furthermore, I’m also using Phing and DBDeploy to handle the database migrates.
But that’s not where the fun stops, I’m also making use of some great Ruby Gems, locally rather than on the server, to compress static assets, such as CSS, JS and images.
A simple break down
It’s quite simple, Capistrano allows me keep the server running super fast for PHP but also allows me to run commands locally on my machine before I deploy to my Git repo and Capistrano does what it’s great at.
The reason for this is that I don’t want my server to get clogged down with Ruby and other languages that may affect the running of the service. At the moment, it’s fully optimised, running XCache and all that too. I know a lot of people prefer to run all the cap tasks on the server, and that’s fair enough because normally they’re all in a team. But I’m working all alone here and would rather to do it locally.
How it’s done
I did a lot of research into the Capistrano deploy file and found ‘exec’ command. This will run a command on your system, and this is what I do:
I’m using the lesscss gem to sort out the CSS (and damn does it save me time). I’m then concat-ing my JS and CSS, separately, and then sticking them through the YUI compressor. This makes them nice and small. Oh and then I’m also using OptiPNG to sort out the images too.
This may seem like overkill, but it works perfectly for me.
And then the rest
So that’s just the little compress task that I do to handle all the static assets, but then when it comes to the other stuff, such as deploying to the dev or production server, running Phing and DBDeploy, Capistrano handles them well too.
Here’s a good tutorial you need to read on how to get you started: http://www.davedevelopment.co.uk/2008/04/14/how-to-simple-database-migrations-with-phing-and-dbdeploy/
That’s where I started, and since then I’ve modified my task to make sure the server does what it’s meant to do: serve files.
Tuesday, June 16th, 2009
This is a really handy tip if you use jQuery frequently and are receiving JSON data back. jQuery’s “$.post” allows you to do a POST call to your application and get the data back, but you have to flag the type of data being received by jQuery so that it can parse it.
This seems silly as jQuery’s strap line is “write less, do more”. So instead of having to do this all the time you want to receive and parse JSON:
It’s much better to define a new function called “$.postJSON” like so:
Now this is listed on the jQuery web site, but it just makes me wonder why it’s not put into the code base permanently. It’s a bit of a shame, but the code can be optimised. For example, when I was working on a project that was built on CodeIgnitor, I modified the function so that I didn’t need to specify the URL as I always used the same controller for my AJAX calls and sent a POST variable called “method” to handle the routing of the call. I had this basically:
And then within CodeIgnitor I had my controller launch a library that had a simple switch that routed the calls, like so:
This keeps the JavaScript and PHP code nice and simple and easy to maintain.
Friday, May 29th, 2009
As soon as I had written the entry about my success with AMFPHP and AS3, I had a crack about sorting it out with CodeIgnitor. It’s been a painful few hours, but I soon realised that my failing was this line in “index.php”:
It needs to be this, to suppress any blank spaces so that the content type is “application/x-amf”:
Awesome! Here’s the CI Wiki page about integrating AMFPHP and CI.
Good question my old fruity. I'm now sticking any post discussions on Google+. Why? Well simply it's better. WordPress's comment system isn't very elegant and nor are ones like Disqus or Livefyre, so to save hassle I've just shipped them off to a social network, like a real boss.