Snippets management

Edwin B. expora at gmail.com
Thu Nov 6 19:52:30 EST 2008


Robert Lehmann <stargaming at gmail.com> writes:

> I don't think there is a one-size-fits-all solution.

I definetly agree.

> Setting up a 'snippets' repository sounds good if you just want to be 
> able to look back at what you've done and/or have a place to stash away 
> quick tests. I have set up a 'sandbox' folder (unrevisioned) and put 
> together a few shell aliases for easier access and it works pretty well. 
> I almost never look back at that code though.
>
> If you develop a lot of small scripts you think you'll reuse in your 
> daily routine, you should add a dedicated 'bin' directory and add it to 
> your PATH.

This is a nice method. I'm already putting it to use. I've learned about
/usr/bin and /usr/local/bin so I went ahead and created $HOME/bin and
added it to my path for this sort of code.

Now, I was thinking more of a notes+code program. Let me give you an
example:

I use Emacs.app (Emacs compiled with --with-ns) and in order to get a
meta key in the Spanish keyboard on my Mac I had to try different lines
but I didn't want to keep all these tries in my .emacs file. I also
wanted to keep the lines that didn't work for later tests in my Free BSD
PC (also with a Spanish keyboard). So I keep all of them in my notebook.

Then, I start coding Python. This time I try to translate an old PHP
script to Python and want to keep a few important lines visible. It'll
be nice to take some notes of the main differences in my scripts in a
different place. Like a student's notebook. Once again, all this goes to
my little program.

Then, I remember I had to run some Mac maintenance commands... I don't
remember the complete line very well, so I go to my notebook.

My point is that sometimes not every note is useful for a program. I
guess as I gain experience all these little notes will be kept in my
mind ;). But as a newbie it seems useful.

As r said, I think it'll be good to write this program. If it doesn't
result in a very useful piece, it'll be a good way to practice.

I forgot to mention I don't use a notes program to keep personal and
programming notes separately.

Thanks mate!

P.S.: Man I hope my English doesn't suck too much.




More information about the Python-list mailing list