Sunday, July 8, 2012

coffee-script is another piece of shit


A few months ago I discovered this new stuff called coffee script, and thought to myself, "this is awesome I'll write less and do more" Today, I tried to continue a development of a pretty fat client side and tried to find myself in the 1000 lines of code I wrote so far (not so many). It was pretty hard, and I'm the only programmer for now, can't imagine how a new programmer would enter to this project.

coffee-script is java-script that look better, no other benefits, and if you plan to write a little more than 200 lines of code, consider using some strongly typed language(that can generate debugable java script) with good IDE that'll help you maintain your code. 

Saturday, July 7, 2012

php post response script execution

I guess it's nice to have so here you go

 * basically allow a php script to return a response and continue with
 * code execution, good for statistics.
 * before echo anything to user call begin and after call end, than you can continue doing stuff
class ScriptContinuationManager
     * this is the point where we need to give a sign to this class
     * that we wanna write our response.
     * @return void
    public function beginRespone()
        header("Connection: close");
        ignore_user_abort(); // optional


     * after this function execution the response will be sent to the
     * client, and code continue without client need to wait.
    public function endResponse()
        $size = ob_get_length();
        header("Content-Length: $size");
        ob_end_flush(); // Strange behaviour, will not work
        flush(); // Unless both are called !