Where's that Snippet?

  • Comments posted to this topic are about the item Where's that Snippet?

    Best wishes,
    Phil Factor

  • A very timely article, indeed, Phil.  I, unfortunately, have to have a whole lot of stuff open on my screen all at the same time because not only do I have my work to do but I have things open in the process of helping other people.  I sometimes can't even remember which screen(s) I was on for my stuff. 

    And, to your point about snippets and larger solutions, I try to keep things in a single directory with multiple subject or technique oriented sub-folders but it's a daunting task to sometime find things and, as you say, even remember that I've once solved the problem and saved code for it.  Every once in a while while search for a snippet of code, I'll run across a title in my files that I just don't recognize.  Since the files are also named after the purpose or technique, it stops me in my tracks when I see something interesting that I don't remember doing anything with.  I open it and, sure enough, I wrote it and I keep saying to myself (especially yesterday) that there must be a better way but, like you I've found that (much like the internet), you can't always find what you need until by accident sometimes months later.

    You're article is great because it lets me know that I'm not alone in having this problem.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • If the goal is maintain a central repository for large teams or public access, then I think GitHub is a good starting point. It's got all the infrastructure required and a programmable API. What's missing would be something like an app or plugin that's geared specifically for submitting and searching code snippets. Considering all the various tools that we use to code in (SSMS, Visual Studio, Azure Portal, etc.), something similar to AceText would be a good starting point for the app, except instead of storing the repository locally, it would hook into the GitHub API.

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • Good features would be bookmarking frequently used snippets and also notification alerts when a bookmarked snippet has been updated by the author. So, for example, we would subscribe to Adam Mechanic's sp_WhoIsActive script and then a notification would prompt us to pull the latest version to our local repository. So, this app would essentially function like a special purpose Git client.

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • Eric M Russell - Monday, January 14, 2019 7:48 AM

    Good features would be bookmarking frequently used snippets and also notification alerts when a bookmarked snippet has been updated by the author. So, for example, we would subscribe to Adam Mechanic's sp_WhoIsActive script and then a notification would prompt us to pull the latest version to our local repository. So, this app would essentially function like a special purpose Git client.

    ...and of course, that would be linked into our continuous pipelines so the latest version would, after appropriate testing, be installed on all servers...

    And, while I'm dreaming, I would like a new bass please.

    Thomas Rushton
    blog: https://thelonedba.wordpress.com

  • ThomasRushton - Monday, January 14, 2019 10:05 AM

    Eric M Russell - Monday, January 14, 2019 7:48 AM

    Good features would be bookmarking frequently used snippets and also notification alerts when a bookmarked snippet has been updated by the author. So, for example, we would subscribe to Adam Mechanic's sp_WhoIsActive script and then a notification would prompt us to pull the latest version to our local repository. So, this app would essentially function like a special purpose Git client.

    ...and of course, that would be linked into our continuous pipelines so the latest version would, after appropriate testing, be installed on all servers...

    And, while I'm dreaming, I would like a new bass please.

    Well, we're talking about code snippets, not production code, so CI is not relevant. If I'm subscribing to 100 different snippets (each a separate project in GitHub), then it can become untenable to keep my local repository updated using general purpose Git clients like SourceTree. When it comes to managing code snippets, the tool needs to be as simple and friction-less as possible or else it won't get used.

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • I've built myself a small CRM / code application where I can place scraps of code and notes on things along with a simple project management application. It works in a fashion and I gradually improve it. Its web based so I can take it anywhere I go. For the more important stuff I will try and generalize the code and write it to my blog. The application has a project management tool in it as well and I can link code to projects as much as anything this gives me context for the more difficult and infrequent functions.

    On occasions I will have to relearn code I once knew well - this I find frustrating but the above gets me up to speed quicker than otherwise. 

    I enjoy constantly tweaking it to improve it - and the tweaking teaches me about asp.net so generally it all helps.

  • I have a strong preference for wikis for this kind of material.

    412-977-3526 call/text

  • For the past year or two, I've been using the Pocket extension for Chrome to archive and tag links to websites. Used in conjunction with the Pocket mobile app, I can tag stuff at work, and then read cached web content offline while on the bus.
    https://getpocket.com/chrome/

    BTW, has anyone tried RedGate's new tool called SQL Scripts Manager? 

    https://www.red-gate.com/products/dba/sql-scripts-manager/

    ... Expert scripts: contains 28 scripts written by expert DBAs, SQL Server MVPs, and Redgate's SQL developers.
    Get additional scripts from the community: share scripts with your colleagues, or with the wider SQL Server community, via the SQL Server Central code archive...

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • Ah! I did something like that over here - let me have a look...

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply