Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: MassCode – a code snippets manager for developers (github.com/antonreshetov)
115 points by antonreshetov on Dec 30, 2019 | hide | past | favorite | 46 comments


Not to diminish the effort, but the use case for this can only be a role that requires a ton of snippet handling, which inherently means you are doing something wrong as a programmer (imho). Once you get to a point where you are regularly using snippets a lot, writing some automated script is the next step, not a tool that makes it easier to copy/paste.


Snippets for me are things I find that I google and copy+paste from stackoverflow semi-frequently. See the example here, it prints the currently loaded settings in Django. I don't use it super frequently (say a few times a month, depending on what I'm doing), but it's faster for me to find with a snippet manager then copying from the same stack overflow answer.

> python manage.py diffsettings --all


just make an alias :o


I frequently have to run this command inside a VM or a docker container, so I can't really use an alias for it.


Or you work with a lot of different languages and you can only keep so many bits of syntax particulars in your head.


What would the "automated script" do?

My use case for snippets is mainly to stub out tests, components, and stories - things that are largely an exercise in boilerplate code with fill-in-the-blanks changes to start with. I can't think of a way to do that with a script that would be less effort than a snippet.


I may be missing some key use cases, but presumably you would somehow use the same snippet again and again otherwise why have it in some tool, ready to go. Once you are using that snippet a lot, then I think the incentive to make it part of the running script is high, or even creating a new repo to track those snippets and then link that somehow.


I've got a lot of things like this in C and C++ for debugging. Like how to make a macro print a macro, or stuff like that.


This was my initial reaction too. Ideally popular code snippets should be published in a library or tool, which can be versioned and distributed easily...

But in reality the overhead of creating and maintaining a library/tool/package can be enormous, for relatively small gains in re-usability (see: https://xkcd.com/1205/).

This snippet library seems more like a step before creating a library, kind of like note taking apps are a step before blog posts or publications.

I think you could still use this and be a good programmer.


If you don't need the syntax highlighting, keepassXC does a good job of this. It's a free password manager. You can create a new folder called code-snippets and make the URL portion of each entry the code one-liner. You can copy url to clipboard from app with CTRL+U. This also has the nice property that you can password protect your snippets. You can also store them in notes or with attributes.

Cherry Tree, Joplin, Zim, Trilium Notes; all have the ability to create a tree-like folder structure.


Just want to say this is great. Poor execution on the demo. README is incomplete. A basic getting started would have sufficed in this case.


Awesome! I've been looking into a way to manage my own code snippets. I'm a huge fan of ThisCodeWorks (https://www.thiscodeworks.com/), which has gamified snippet storage to an extent. Also great for sharing snippets around. It's still in beta, but looks good so far!


I was recently looking for one and I will check it out, but I think I'll probably just use some git folder with snippets and a ripgrep alias for searching, I don't need much.


Your demo gif doesn't convey your idea __at all__. What is going on in it? To me it just looks like you are typing in a hello world function in jaavascript... where does the snippet portion come in? After I create a snippet, how do I use them in my current project and current editor? I really think you need to create demos showcasing these use cases cause as of right now i'm confused as to why this project even exists.


Here, I rewrote your comment to say the same things in a friendlier way. There are nicer ways to provide feedback.

> I would recommend updating your demo GIF to more accurately portray the idea. Perhaps instead of just typing the function into the text editor, it should also convey how snippets can be saved and reused at a later point. This would give me a better idea of how to utilize the project.


Stet.

The comment wasn't particularly unfriendly at all. It didn't contain any personal attacks or contentless bashing. Indeed, the comment did something valuable: identified a problem, and thoroughly described why it was a problem. If the only way some one can give usable problem analysis and criticism is by including suggested fixes, and delicately toning down the criticism, then far fewer people are going to be willing to expend enough effort to interact beyond meaningless cheerleaderism.

In fact, your suggestion of a different way to criticize comes across to me as incredibly condescending -- to both the commenter and the original author.


I agree that the original comment was not overtly _un_friendly. I also think that the reply represents a better way.

> If the only way some one can give usable problem analysis and criticism is by including suggested fixes,

I think we can all agree that the inclusion of suggested fixes does make feedback more helpful in general.

> and delicately toning down the criticism, then far fewer people are going to be willing to expend enough effort to interact

It does require a little additional effort to write kinder feedback, to take the moment to address the human being behind an Internet comment in a similar way to how we might address a person face to face. I'm as guilty as any of failing in that way.

But if criticism's aim is to improve, it will be more successful if it's more easily digested by its audience. You catch more flies with honey than vinegar and all that.

And really the reply above isn't that big a difference. In my view, it's a sign of intelligence, learning how to communicate effectively. If raising the bar only this high results in "far fewer people" interacting, maybe that's a good thing. I don't really need to hear from people unable to tame their own words when they have no time limit on typing them, and I'd rather belong to a community with fewer responses but a higher proportion of politeness and shared humanity than an array of comments expressing the kind of gruff emphasis on failure that bookends the original comment, "Your gif doesn't convey your idea __at all__," and "i'm confused as to why this project even exists."

Edit: BTW today I learned "stet" thanks to you.


Including good suggested fixes is certainly better than not. But no suggested fixes are better than bad suggested fixes. Finding problems is a different skill set than proposing solutions. Letting people with these complementary skill sets coöperate in improving something seems to be better than requiring one person have both. The perfect is the enemy of the good.

I'm not sure why emphasis on failure is a problem, when that failure is precisely what is being communicated. However, the comment certainly does look a lot more unfriendly in light of the responses. Perhaps I was too kind to "i'm confused as to why this project even exists", because I don't understand why I would ever want "code snippets" myself.


As a product person, I want to hear someone's proposed solutions even if their ideas are crap. The reason is that sometimes their proposed solutions help me understand the problem better, and sometimes there is an aspect of their proposed solution that makes it into the final solution too.


There was nothing unfriendly about the original phrasing.


Op communicated their emotional noise rather than being constructive (signal). The content is there in between the complaints.


Can anyone tell me why some comments, like this one, are darker than others? It would appear lighter with the default scheme.

Image showing what I mean: https://i.imgur.com/Beo2qve.png


Those are comments that have been predominately downvoted.

From the FAQ: https://news.ycombinator.com/newsfaq.html

> Why don't I see down arrows?

> There are no down arrows on stories. They appear on comments after users reach a certain karma threshold, but never on direct replies.


Thank you! I wasn't aware there were even downvotes, so I didn't think of that as a possibility.


I believe it means the post was down-voted below zero.


I agreed with what you're saying, but there's a nicer way to say it. Please be a little more considerate.


[flagged]


Please read the guidelines and follow them when posting here.

https://news.ycombinator.com/newsguidelines.html

Edit: you've broken them badly in the past as well: https://news.ycombinator.com/item?id=21721337. We ban accounts that post like this, so please don't do it again.


Whatever. I'm NOT going to walk on eggshells with every comment I post in hopes I don't offend or hurt someone's feeling. I didn't personally attack anyone in my original comment, but for reason, someone takes it upon themselves to attack me personally and now I'm being ridiculed for it.


I'm certainly not ridiculing you! I'm trying to let you know what the site standards are so you can follow them and use HN as intended.


yes you are. you said nothing to the other two people who stated that my original comment was harsh (for whatever their reasons were), of which their comments added _nothing_ to the conversation, they were personal attacks against me. i simply just stated that they are being over sensitive and need to grow up (which, personally i think they are being and need to). i didn't use any profanity and say anything threatening, yet i get called out by you and not the other two. why? don't cite and hide behind guidelines if you're not going to apply them to everyone. you are ridiculing and personally attacking me and i'm not going to stand for it.


Of course, I will update README in more detail later. Now all my time is spent on PoC. MassCode is an application for organizing snippets such like as SnippetsLab, Quiver or Boostnote. What makes it different is that it uses Monaco editor as a code editor, it allows for autocompletion in the main frontend languages - HTML/CSS/JavaScript. And of course Emmet :)


awesome!


What? This is literally just Apple Notes for code snippets. What’s the confusion?


Nice. Does it store the snippets in a got repo? Or can it use gitlab or GitHub snippets as storage, if not, that would be handy.


If you’re using VS Code, you can checkout GistPad, which allows managing code snippets, mini-docs, and interactive/CodePen-like playgrounds, all backed by GitHub Gists: https://aka.ms/GistPad.

Disclaimer: I built GistPad, and am just mentioning it since you mentioned GitHub-based snippets.


I use Sublime as my code editor. Anything that I need to save as a code snippet goes into its own Snippets project. That way, I can organize it easily and open up the project whenever I need it. No separate application necessary since Sublime is already editing my code anyways.


Very cool project. I like that you have matched the mac os design. Working on a note app and aiming for a similar UX.

Anyone having an idea how to come close to MassCode's UI with a React.js UI library? Is there anything out there, which is similar?


Tried running locally on Linux but ran into issues and gave up. It seems useful and I like how it looks.

"npm build" SHOULD get it running locally but it didn't for me. Did anyone else get it working?


Is there an integration with VS Code or Atom?


If you’re interested, I built a snippet manager for VS Code that uses GitHub Gists for persistence. That way, you get a productive, in-editor experience, while still being able to keep your own data/code, and can benefit from the existing ecosystem and primitives that have been built around gists (e.g. embedding gists into Dev.to/Medium blog posts, opening a Gist-based Jupyter notebook in NbViewer).

It’s called GistPad, and in addition to allowing you to create/manage code snippets, it supports easily moving files between your local machine and gists, pasting images, starring/forking gists, viewing and replying to comment threads, and creating “playgrounds” that are CodePen-like runnable samples: https://aka.ms/gistpad.

Additionally, since it’s a VS Code extension, you can easily edit/manage your snippets, while taking advantage of your existing editor setup/language support, using your favorite extensions, arranging files into arbitrary grid configurations, etc.


Thanks for the work on that extension, it's very useful.

Can it support private gists? I couldn't find a way to enable that.


Yep! You can run the “GistPad: New Secret Gist” command, or right-click the “Your Gists” node in the Gists Explorer and select “New Secret Gist”. Let me know how that works for you!

“Secret” is the term that GitHub uses (as compared to a private repo), which is why I call them that.


wow, this looks great!


Thanks! Let me know if you get a chance to check it out, and have any feedback (https://github.com/vsls-contrib/gistpad). I’m iterating on it pretty quickly, and am looking for more input about other developer’s use cases


How does this compare to SnippetsLab? I see it’s inspired by SnippetsLab


I use the MoinMoin wiki for this.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: