How to copy snippets from Github Gists to Dash

If you’re a Dash for MacOS user, here’s a little script to copy existing code snippets saved as Github Gists into the Dash snippets database.

Dash for MacOS is an application that allows to keep a local library of a multitude of programming frameworks and libraries, so that you can search this library quickly using an offline intuitive interface.

Dash

Dash has a feature for creating and managing code snippets – there are many other alternatives out there for this – but probably the fact you can store snippets alongside other documentation could be a winner in this case.

Anyhow, since I’ve been collecting lots of snippets as Github Gists, I thought I’d be nice to load them up into Dash so to test it out a bit more!

Note:

– the solution below does not extract tags information at the moment

– always a good idea to make a backup copy of the Dash database before messing with it. Then just update the value of the DASH_DATABASE parameter in the script and start the extraction.

– inspired by another gist: https://raw.github.com/gist/5466075/gist-backup.py

 

So here we go:

 

Share/Bookmark