Emmet has a really awesome plugin for sublime text.The plugin depends on PyV8 to function.But by default the plugin tries to download the latest version of the plugin from the internet.This is all well until you have a stable internet connection.Since PyV8 is not updated frequently you can download the binary locally for sublime to use.

This are the instructions I followed to get the plugin to work offline.

  • First download pyv8 binary for you operating system from here.
  • Then click on Sublime > Preferences > browse package.This will open the file explorer/Finder.
  • Create a directory in the Packages folder called PyV8.Extract the binary into that folder.Example(PyV8/osx-p3) osx for the operating system.
  • In the osx-p3 directory you will find a config.json file.Open the file in sublime and change skip_update from false to true.
  • Now its time to edit the emmet config file.Click on Sublime > Preferences > Package Settings > Emmet > Settings – User.Add the following line to it ‘{“disable_pyv8_update”: true}’.

Now you can use sublime with emmet.io offline without needing to download PyV8 every-time on launch.


Today I was working with one of the startups at the cribb on their project to clean up their code and fix a critical issue with the it.

The codebase was not large but it was kinda modular.Being an MVP the product worked, it was serving a bunch of users.Unfortunately the code most important for them was a bit buggy.It was creating multiple connections to the database on a single request.This problem was exaggerated by the limit the hosting provider put on the number of database connections to it.

So we sat down to fix the code.Unfornately the code didn’t have test ,I wouldn’t blame them as it was an MVP.So we manually tested the website.We turned on debug messages and we were off fixing the issue.

The main problem arose at the database connection class.This class was used to create connections to the database and every instance of this class would start another connection to the database.

The obvious solution that came to mind was to write a singleton, which is mostly frowned upon.But we decided to do it anyways.Moreover it had been a really long time since I touched PHP code.So after going through  some old code from other projects.I found realized how easy it is to forget such stuff.Code which I once thought I was a master off was completed erased from my head.Lucky the concepts still stayed with me.

Fixing the issue on the database was straight forward we created a singleton database connection class which other models would use to query for information.This brought down the connection count to just one as it is supposed to be.

Singletons is well know for being an anti pattern as it is makes testing difficult or it being used as a global variable.But in this case the singleton pattern was really benificial.