Ask HN: How do you organize your personal code library?

20 points by rcdmd ↗ HN

19 comments

[ 4.5 ms ] story [ 61.7 ms ] thread
What do you mean by "code library"?
Code you write that may be re-used by yourself.
I would also include code used by the library (say in another program/project) or downloaded for compilation/use/reference.
(comment deleted)
I'm having a GitLab instance on DigitalOcean, more than enough for all my code. Probably 30+ repos in there, most of them inactive for quite a long time.

No special organisation. Just git repos.

My method is DIY and dirty: Git project folders generally sorted by language, in Dropbox for availability across computers. It's not perfect when I have projects that span more than one language, so I'm open to new ideas! Do symbolic links work in Dropbox? Backups live across a couple different pieces of external media for resilience.
Seems like this would be a nightmare with a lot of languages' build cycles. Dropbox is already quite a CPU hog, and I'd imagine it'd be a nightmare to run something like a typical Maven build that was producing all sorts of target output that'd I not want synced. Most cloud storage apps don't make it easy to ignore subfolders.
Most of what I've written has been for work, so I can't keep copies of that. In my own hobby projects, there's usually so little overlap that I can't meaningfully share much code between them. I've got a couple of classes that have found use in more than one project, but I usually just copy those from one project to the next, as necessary.
I use Gogs[0] to host a private git server on a subdomain of my website. It's designed to be more or less a clone of github, so there's minimal learning curve, and since it's written in Go (single binary) it's much more light-weight than GitLab and very easy to get up and running.

[0] https://github.com/gogits/gogs

Github.

Github is a great place to store your reusable code. You can even choose to include it as a submodule in future git-based projects.

I use gist and github for my personal drawer of code snippets. For example, At a time I was writing a lot of C code. I would typically look at my previous projects to see how I've done things in order to not have to re implement my own functions.
For things I'd like to have out in the open I use github.

For things I'd rather keep private I use bitbucket, who have free private repos.

I write mainly Mac apps. I have an Xcode project which contains all my "common" code. It builds to both a framework and a static library.

I include this project as a subproject in all my apps that use it.

I'n each git repository, it's a submodule.

Hi there, I am the developer of canSnippet (https://github.com/ademcan/canSnippet). canSnippet is a web application that needs to be installed on a server and can be used to save/share code snippets. I will be back to it soon and add some more features, and also a better theme :) Don't hesitate to ask me if you have any question.
For learning, I have a directory in my Dropbox called "Programming" with a subdir for each programming language. Then I make my test projects/tutorials in single dirs, for instance: /Dropbox/Programming/Lua/helloworld

For other projects which may or may not develop into something bigger I put it on Github now that my subscription offers unlimited private repos. Previously I hosted them on Gitlab.

I like to organize the projects with Git because it'll often go months between when working on different private projects and by looking at the Git log I quickly see what was the last thing I worked on to get back on track.