TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How do you organize your code on your machine?

41 点作者 wfarr超过 15 年前
Currently I have a Code directory which is littered with all sorts of stuff and in general is pretty unorganized. Between small code snippets and fully-fledged projects, the whole directory is a complete mess.<p>So, how do you organize your code?

29 条评论

pquerna超过 15 年前
<p><pre><code> ~/code ~/code/${company_or_topical} ~/code/${company_or_topical}/${project} </code></pre> Where company or topical are things like 'cloudkick', 'asf' or 'personal'. (I guess you could say, its "who owns the IP").<p>Some of these subdirectories are actually symlinks to encrypted DMGs, again depending on who owns the IP.<p>Project is the top level checkout of the projects.. My 'asf' (aka Apache Software Foundation) directory contains 84 project level checkouts.<p>I also keep a ~/work/temp directory full of random source tarballs if I need to look at how something works. Currently contains glibc, python 2.6 &#38; 3.1, dojo, and about 30 other open source projects, normally ones I'm not normally involved in patching, but often run into... difficulties with. Nothing resolves bad documentation quicker than looking at the source code...<p>I tend to nuke temp once every 6 months.
评论 #1021759 未加载
评论 #1017781 未加载
评论 #1017756 未加载
评论 #1017938 未加载
评论 #1017751 未加载
Calamitous超过 15 年前
Everything I'm currently working on:<p><pre><code> ~/Projects </code></pre> Older stuff, or projects on hold:<p><pre><code> ~/Projects/ARCHIVE</code></pre>
评论 #1017583 未加载
评论 #1017707 未加载
评论 #1017711 未加载
algorias超过 15 年前
Each project gets its own folder that contains branches, helper scripts, release files, notes, etc. Nothing related to the project goes outside that folder... except:<p>Working copies, demo code, samples, etc of dependencies of my projects are kept separate to avoid polluting my backups with stuff that isn't mine.<p>When learning a new language or framework, I consider it the same as a project and make a corresponding folder. Good to keep learning material, notes, project Euler snippets, etc.<p>Random snippets, quines that print sierpinski's gasket, and other useless stuff goes into the "Snippets" folder.
sidmitra超过 15 年前
Two folders,<p>Sandbox: Contains code i'm working on or projects that i still consider active. Some of them i've converted to github.<p>Archived: Contains old projects or code, that are inactive, or somethings that are not on my plate in the near future.<p>For code snippets you might use gist on github, but i tend to use onenote. I have a queries notebook open on MS Onenote, and anytime i google search some new snippet, troubleshoot advice, configuration detail etc, it goes that notebook, with keyword tags.
cschep超过 15 年前
Weird, I thought this would be more common, I use:<p>~/Dropbox/code/&#60;language&#62;/&#60;project name&#62;/<p>it's all backedup and available immediately on all my machines, pretty handy. sometimes I use git inside of dropbox, but I'm still learning git in a real way so not all of my code is in it.<p>This is a fun thread to read, I'm starting to question my methods. At the very least seems like there is no reason not to have everything I write inside of git (or some version control).
评论 #1017748 未加载
Hexstream超过 15 年前
One thing I can tell you: I'll NEVER be satisfied with how my code is organised on a hierarchical filesystem (and don't tell me I can simulate a graph properly with symlinks).<p>I think some sort of tagging filesystem would be appropriate.<p>Also, I hate how most programming tools assume I want to choose a "canonical" representation of code into files. I'd want to mostly don't care how the code is organized on disk and then write queries which let me view and edit code coming from multiple different files at once.<p>As a completely hypothetical, contrived example, let's say I was still doing Java and had a big class with many getters and setters, I don't want to choose whether I want the getter and setter of each attribute organised in pairs or whether I want all the getters first and then the setters. I want to be able to write a query that will constitute a new view, so if I want either option I just have to switch views. A third view would simply be the physical representation on disk, which is still needed from and dependencies-loading standpoint. This way of working would truly shine in much more complex scenarios but I hope you see what I mean.
rsclarke超过 15 年前
Two folders, 'sandbox' and 'projects'.<p>'sandbox' is organised by language, with code snippets and small projects in each folder. If anything becomes of the small projects they migrate to the 'projects' folder. Anything in the projects folder means it must be in a repository, git or svn.
jcsalterego超过 15 年前
~/gh/ is where I throw all my GitHub clones.<p>~/svn/ is where I throw my SVN checkouts (sometimes google code stuff, but mainly just python trunk until it gets fully hg'd)<p>~/scratch/ is where I create subdirectories for my quick-and-dirty scripts, or if I need to `cat` something somewhere real quickly.
评论 #1017924 未加载
breck超过 15 年前
My good code I push to github. Everything else I occasionally delete or archive to my dropbox folder.<p><a href="http://breckyunits.com/code/how_i_organize_my_dropbox" rel="nofollow">http://breckyunits.com/code/how_i_organize_my_dropbox</a>
mark_l_watson超过 15 年前
I have a system that works well for me, basically separating small test/experimental bits of code from code for customer projects. I'll talk about the layout of book code later.<p>I keep small test/experimental bits of code in sub-directories of top level directories labeled Java_stuff, Lisp_stuff, Scheme_stuff, Ruby_stuff, Python_stuff, etc. Each test/experiment is in a well named sub-directory. These small experiments are useful for both learning and for later reuse on real projects.<p>I keep each active customer project in a directory with sub-directories for documentation, code, and test data.<p>For work on books: similar to customer projects: sub-directories for source code, for figure files (OmniGraffle and exported vector PDF files), for code examples, and for Latex (or OpenOffice if I can't use Latex).<p>I also keep a temp directory for downloading, building, running, and perusing source code for projects that I read about on the web. I periodically delete stuff in temp that is older than a few weeks old.<p>Finally, not specifically for code: I use Google documents to make copious deployment notes which I use for reference for future projects.
评论 #1017787 未加载
walesmd超过 15 年前
I don't keep any snippets around on my machine - just have a knack for remembering how to get to a specific snippet via Google.<p>Each project gets its own directory that contains everything needed for that project (unless I have a shared framework, library, etc). All the projects are committed to a private SVN repository although I am taking a serious look at Git lately.
评论 #1017755 未加载
评论 #1017600 未加载
Zev超过 15 年前
<p><pre><code> $HOME/Projects/&#60;Project Name&#62;/ $HOME/Miscellaneous/&#60;Language&#62;/&#60;description/ $HOME/College/{Fall, Spring} &#60;year&#62;/&#60;class name&#62;/{Lab, Project} #/ </code></pre> Which is all mirrored in a private svn repo I've got running on a VPN.
njharman超过 15 年前
<p><pre><code> ~/work/fooN </code></pre> Where fooN are svn (possibly other) working directories.<p>My personal (at home) is slightly different cause I have a lot more stuff than just code revision controlled.<p><pre><code> ~/work/art/ ~/work/src/ ~/work/sys/ ~/work/web/ ~/work/words/ </code></pre> "sys" is /etc and other <i>sys</i>tem files from various machines. "web" hearkens to the days when websites were static html and images. Probably should merge that with "src" someday<p>In src I have some directories such as "hints", "icons", "perl", etc. into which to stuff bits of things that don't deserve their own VCS repository.
awolf超过 15 年前
~/Projects/ for what I'm building<p>Everything else is in my svn repo that I can access from anywhere with svn+ssh.<p>Recently, I've started putting code spippets that I think I will re-use in my Dropbox.
dannytatom超过 15 年前
<p><pre><code> ~/ ls dev/ freelance opensource personal slum </code></pre> Fairly self explanatory, slum is for random one-off things that probably won't go anywhere.
gte910h超过 15 年前
I have a directory off the root FS for code I own, a directory off the root for each other IP holder and each person's code goes in their own directory.
johngunderman超过 15 年前
~/projects : where I keep my personal projects<p>~/extern-projects : where i pull other projects from github and stuff, just to mess around with / bugfixes<p>~/src : where I store little scripts or test code, just a sandbox area to mess around.<p>~/test : i send testing tarballs here, basically anything I don't care too much about, as I empty this folder out periodically.
keefe超过 15 年前
insufficiently<p>currently : master git repository for everything, something like ~/docs lots of breakdown of documentation more git repositories under : ~/docs/code/projects - stuff I am currently working on or using ~/docs/code/legacy_projects - stuff that I don't want to die or need for reference, but I've lost interest for one reason or another ~/docs/code/public_projects - mirrors of servers, portfolio pieces, videos, all sorts of things that other people can see<p>I've been flirting with mavenizing everything for some time, but I just can't seem to overcome the inertia of... current build process works, code needs to be written, deal with it later
cmelbye超过 15 年前
~/Projects/ for important projects (i.e. not git clones of random GitHub projects, but major personal/work projects)<p>I don't have many other random code snippet things, but they generally go into Dropbox for easy storage.
grayrest超过 15 年前
<p><pre><code> ~/dev -- projects I'm (semi-)actively hacking on ~/Repositories -- checkouts of dependencies and projects I'm tracking but not hacking ~/arc -- same as dev but for work</code></pre>
malkia超过 15 年前
Just ~/p<p>~/p/slime ~/p/go ~/p/ccl ~/p/sbcl<p>In ~/p itself I'm putting some .el scripts, .txt, .bat, .sh, .cmd files for various updates (when going to the folder and doing "hg pull", "svn update", "git pull", etc. is not enough).
newhouseb超过 15 年前
I have a "Playground" folder with a ton of randomly named projects in it. I like using the word "Playground" because then I don't feel guilty if I don't finish something...
JeffJenkins超过 15 年前
~/&#60;Project&#62; for anything active, ~/Content/&#60;Project&#62; for anything I've stopped working on.
selven超过 15 年前
"/.../Desktop/project_name" contains all the files for that project. Every project has its own directory.
ErrantX超过 15 年前
exactly the same way - a mess<p>The beauty of a hosted SCM (I use Bit Bucket) is that I only have to remember to "pull" when starting work on a project and "push" when finishing and it is all kept safe :)<p>I swap between about 4 or 5 machines here and at work so the chances of keeping it sane otherwise are low :)
jdietrich超过 15 年前
Git.
评论 #1017762 未加载
评论 #1019991 未加载
revoltingx超过 15 年前
I use eclipse because it has support for a lot of the different languages I have to work with. So I organize my projects by language first under an eclipse workspace folder.<p>~/workspace/perl ~/workspace/erlang ~/workspace/cpp<p>Then inside each folder there is a project. And I either create them or import them using eclipse.<p>For projects that are large and require a large number of languages. I simply create it under the workspace directory. (i.e. ~/workspace/MyBigProject)<p>And from then I break it down into languages again along with other folder necessary for larger projects.<p>MyBigProject -&#62; bin/ conf/ docs/ erlang/ perl/ sql/ web/<p>Then I tend to use the best possible layout for a project of that language. For example since I use CGI::Application a lot using perl, my perl folder uses the following structure:<p><pre><code> perl -&#62; deps/ &#60;-- cpan/other modules that are needed MyBigProject/ &#60;--Namespace for project modules startup.pl &#60;- mod_perl2 startup file templates/ &#60;- HTML::Template templates... and MyBigProject breaks down like so: MyBigProject -&#62; DB/ UI/ (Other Modules)</code></pre> and so on, the same goes for the erlang OTP:<p><pre><code> MyBigProject/erlang/ -&#62; db/ deps/ ebin/ Makefile src </code></pre> and MyBigProject/web just holds all the html/javascript/css files for the WebUI.<p>And so on.
评论 #1017942 未加载
vlisivka超过 15 年前
~/projects/PROJECT — my personal projects (no longer used);<p>~/projects/package-gen/dst/PROJECT — my personal projects in RPM package format, with automatic build system, various templates for new packages, repository of built binary and source packages;<p>~/work/PROJECT — work;<p>~/bin — various personal scripts and programs;<p>~/tmp — scratch, e.g. ~/tmp/1 or ~/tmp/foobar;<p>~/gtd/projects — various stuff, sorted by purpose, tag or/and date. Links from here to many other places;<p>~/gtd/income — various stuff, to be sorted;<p>~/examples — various <i>working</i> snippets;<p>/usr/share/bash-modules/ - various typical functions for bash scripts, e.g. "backtrace" or "..." (recently created as alternative to ~/examples/bash-..., see <a href="http://vlisivka.pp.ua/en/bash_modules" rel="nofollow">http://vlisivka.pp.ua/en/bash_modules</a> ).<p>I use very simple tagging tool to speedup sorting, e.g. "s foo.tar.gz foo bar" will create two <i>hard</i> links to "foo.tar.gz" file in ~/gtd/projects/foo/ and in ~/gtd/projects/bar/ directories, and so on.<p>Currently, I use RPM packages only for my own projects, because they are easy to install/uninstall/upgrade, they contains documentation, changelog, and description, they are easy to verify or rebuild, and so on.
评论 #1017946 未加载
wendroid超过 15 年前
<p><pre><code> appl/*/*.b module/*.m</code></pre>