Better Sublime Text Project Management

If you’re working with multiple projects, then quickly switching between them is a necessity. For years I’ve been going between the built in project manager in Sublime text and simply opening Sublime up from my project directory in the terminal.

Opening from the terminal gets annoying after a while, and the built in project manager for Sublime is good whilst it works, but the issue is that it forgets about projects that haven’t been opened for a while – they disappear from the quick switch list, which means opening up the project file manually all over again. The other downside is that you have to manage the Sublime project file and the Sublime workspace file.

Fortunately, there’s a great little package for Sublime called “Project Manager”. This is everything the built in Sublime project manager should be. No need to worry about where the project and workspace files are as they’re all centrally stored on the fly when you create a new project. The quick switch doesn’t forget about projects that haven’t been opened in a while either. It’s super easy and fast to use. No more project management hassle!

A really convenient way to increase Mac storage

I own the MacBook Pro (Retina, 13 inch, early 2015), and for the past 6 months I’ve been battling with the limitation of 128gb hard drive space. It’s been painful – constantly moving stuff over to an external hard drive, storing stuff in the cloud and deleting junk files etc.

I’d previously tried out SD cards, but they weren’t suitable or safe since I work from place to place and my laptop is always sat at different angles – this means the SD card would be susceptible to damage or snapping due to it sticking out.

After research I assumed that the only thing left was either getting a brand new Mac or digging in and replacing the hard drive myself. Fortunately, I came across a saviour – Transcend JetDrive. These babies don’t protrude from the mac at all, once inserted, they lie flush to the side of the MacBook. You can pick ‘em up in 64gb, 128gb and 256gb versions.

20180908_215136

The only downside is that they’re a bit tricky to get back out – for me that’s not a problem as I intend to just keep it in the slot permanently. I do occasionally need to use the SD Card slot for other means, like transferring data from a camera, but for that I’m just going to use a USB SD Card Reader in the future.

A super cool way to turn Websites into OS X Apps

Sometimes I prefer using the web interface for websites over the desktop app, and sometimes the website I’m using doesn’t provide a desktop app at all. In these situations I find it annoying to keep a separate web browser tab or window open – especially if it’s a site that I’ll be using frequently. I’d much rather have it sit open in my Dock, waiting and ready to be used like a normal app.

Fortunately, I recently stumbled upon this little gem: Fluid – https://fluidapp.com/. You simply open it up, give it a website url, a name and an optional icon and hit create. You’ll now have a brand new “app” that will open up and stick around in your dock just like a normal application.

First thing I’ve done is use fluid to create an app for the Facebook “Messenger” website. Since an official desktop client doesn’t currently exist and the third party solutions I’ve tried over the years are always breaking (Goofy etc).

AF836F05-FFA5-44E1-8577-08F5C7738FA8

5E766FEA-488C-4075-BE42-CC08278DE940

Secondly, I’m accessing a Task Management website all day through the week for which a desktop client doesn’t exist – this now sits in my Dock for convenient and fast access.

Fluid has been a great find and something I expect I’ll find many more uses for.

Troubleshooting PDFKit and wkhtmltopdf in Rails

I’ve spent the past couple of days trying to generate PDF files successfully with PDFkit and wkhtmltopdf. It’s been a frustrating process to say the least.

Tips

1. You can’t use files with any other extension than .html when passing a file to PDFKit.new, they must be .html files.

2. If you are trying to include assets in the PDF by making requests to your local server, you’ll need to run a web server capable of handling multiple processes (Unicorn or similar), otherwise the request will hang. I got around this by just including the required assets inline in the page.

3. Be careful with the file content that you’re passing to PDFKit, certain HTML syntax cannot be converted to PDF successfully.

4. If the page you are converting to a PDF is dependent on javascript generating content that might not be immediately visible, you will need to pass a javascript_delay option to PDFKit.new. E.g. :javascript_delay => 1000.

5. To have a better chance at debugging the issue causing you trouble, set the verbose option to true in a PDFkit initializer.

6. Get familiar with using wkhtmltopdf. PDFKit is just a Ruby wrapper around wkhtmltopdf, so try and reproduce the command that PDFKit is running by manually entering it in your terminal. This way you can rule out wkhtmltopdf being the troublemaker and narrow it down to an issue on the web server.