Updates from December, 2011 Toggle Comment Threads | Keyboard Shortcuts

  • Pablo 11:56 AM on 20 December 2011 Permalink | Reply  

    Php Obfuscator / Compressor 

    This is a class i made to compress and obfuscate php code, it is designed with specific coding style in mind, nothing crazy, everything should be easy to find by a Regular expression.

    https://gist.github.com/1501834

    Variables, functions & classes are minifyed, spaces removed. The replacement pattern is $foo –>  $_1   and the number will be incrementing each match.

    Enjoy.

     
  • Pablo 8:59 AM on 14 December 2011 Permalink | Reply  

    Abstracting database manipulation and other stuff…. 

    I’m currently working on a medium-to-large website for the agency i’m currently working, and i stumble upon a very interesting situation.

    Apparently, i will have to code this site without knowing yet which database engine we are going to use. So now my only option to avoid affecting my job is to do implement a Factory pattern on the data structures i will have to use.

    So i will create a RepositoryFactory object which will return repositorie’s interfaces, which in turn will return concrete data objects.

    This way i think it will be the best option, so now i will be able to create a FakeRepository and create the data object by hand, so when the engine war ends, all i will have to do is to implement the final database engine chosen.

    I write this because this is the first time i have to implement a design pattern by a real need, i generaly do it but because i try to code the best i can, but this time, the pattern MUST be used. And what a cool solution!

    So the final product should look something like:  RepoRacotry::getXXXRepo()->getSomeData() 

    A repo who will return repositories interfaces… and initially, i will implement fake concrete repositories. The data objects will be plain php objects ( no methods or anything, just vars )

    –Also: I’m starting to use the Symfony Components by picking and implementing just the ones i like, and it’s a very fun process. Symfony2 is a very cool framework.

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel