-12

I just had this need for storing a snippet of code, I made, for my future self. In this case, it was an attempt at parsing a file in an effective way in C, approximately 45 lines.

I want it to stay persistent and be able to consult it later on. I thought maybe I should put it on a drive or something, but it will get messy. GitHub will be overkill for something small.

Sometimes I use Stack Overflow to keep a bookmark of question I should visit now and then. It would be nice to do it for a personal snippet of code, accessible only on my user page.

3
  • 8
    "Github will be overkill for something small." Even GitHub's Gists? I don't think adding something like this should be a priority for SE, personally. They were built to fill the niche of a free Q&A repository.
    – vandench
    Dec 7, 2023 at 16:09
  • @vandench well it's fair to expect this to be part of the same platform, i.e. Stack Overflow, makes it easier to keep. Dec 7, 2023 at 16:10
  • If you wish, you could post it to Code Review. You can get feedback of your code, and have it published on-site for future reference. Dec 9, 2023 at 4:53

1 Answer 1

3

In case you don't mind the code to become public, you can post it as answer in the Stack Snippets Sabdbox in Stack Overflow, then you can save your own answer:

answer screenshot with highlight around the Save button

Once saved, you can add private note about the answer and access it easily and quickly from your profile's Saves tab:

screenshot of answer in the Saves tab of profile

In case it is not public, you can delete the answer and it should still be accessible for you in the Saves tab.

5
  • But this can't be arbitrary code as it is public(?). Do you suggest making an answer, pointing to it in 'Saves', and then immediately delete it? Dec 8, 2023 at 22:35
  • Saves also permit private notes.
    – PM 2Ring
    Dec 9, 2023 at 5:47
  • @This_is_NOT_a_forum thanks, somehow on first read I had the impression OP means code they found, not theirs. On second read I see I was wrong, and it makes a big difference, I'll think how to edit the answer to better reference it. Dec 9, 2023 at 9:26
  • @This_is_NOT_a_forum edited, and yes as long as it's not done many times, deleting in order to keep it semi-private should be fine. Dec 9, 2023 at 9:54
  • 1
    @PM2Ring thanks, added this to the answer. Dec 9, 2023 at 9:54

Not the answer you're looking for? Browse other questions tagged .