TL;DR — Here are the links to download the code snippets:
Codebox is a simple yet easy to use, user-friendly code snippet manager for mac to manage the snippet libraries of the users in Mac OS X. With this CodeBox, users can easily copy snippets from Codebar and can paste them instantly in the ‘preferences’ menu. Codebox works as a code snippet manager for mac which helps users to organize snippet libraries in Mac OS X. Type shortcut ctrl + shift + i or on Mac cmd + shift + i or find Import snippets from Snippet Store in vscode right-click menu A vscode quick pick window will popup and allow you to pick your snippet After select your snippet, your snippet will be import into vscode at the cursor position.
Some Background
My coding world and coding life has changed a lot in the last year and a lot of it was driven by moving to a Macbook Pro. I moved to a mac not so much because I love MacOS — it’s mostly about forcing myself to learn to code .NET Core and ASP.NET Core without relying on Visual Studio. That means that I’m using Visual Studio Code for most of my work.
That initial transition from Visual Studio to Visual Studio Code was a little rough and a lot of it was because I not only leaned heavily on Visual Studio but I also leaned super hard on CodeRush and my custom CodeRush templates that I’d created over the years. It was painful enough that I rewrote all my CodeRush templates as Visual Studio Code snippets.
Our Hero Tries New Things and Doesn’t Hate Them
Fast-forward about 9 months and I’ve been switching between Mac and Windows a lot. Then a couple of things happened. 1) I had a conversation with Joseph Hill about Visual Studio for Mac and 2) I saw this Visual Studio Productivity Tips video by Robert Green and Kendra Havens.
Joseph drove home the point that Visual Studio for Mac is *NOT* just for developing Xamarin-based apps — it’s also good for doing ASP.NET Core development. He suggested that I go give Visual Studio for Mac another try. I did…and it’s good.
Then there’s the Robert & Kendra video. That video is mind-blowing. I’ve been using Visual Studio for *DECADES* and there were a ton of features that I had no idea about. I decided to give Visual Studio a try without CodeRush…and it’s good. There are still some things that I miss from CodeRush but whateryagunnado? (shrug)
Code Snippets for Mac and Code Snippets for Visual Studio
So I started using Visual Studio for Mac a lot and I started using Visual Studio 2019 a lot without running CodeRush. But I still needed/wanted the snippets that I wrote for Visual Studio Code.
One thing that’s a little frustrating is that Visual Studio Code, Visual Studio for Mac, and Visual Studio all have different formats for their snippets. So I wrote a utility to read all my Visual Studio Code snippets and translate them to Visual Studio snippet format and Visual Studio for Mac snippet format.
The Snippets
Category | Shortcut | Description |
ASP.NET | mca | ASP.NET controller action method |
ASP.NET | mcap | ASP.NET controller HTTP post action method |
ASP.NET | r404 | ASP.NET controller return 404 not found |
ASP.NET | rbr | ASP.NET controller return 404 not found |
ASP.NET | rnf | ASP.NET controller return 404 not found |
ASP.NET | rr | ASP.NET controller redirect to action name |
ASP.NET | rrid | ASP.NET controller redirect to action with id |
Coding | b | Code block braces |
Coding | c | Public class |
Coding | cwl | Console.WriteLine |
Coding | fe | foreach statement |
Coding | i | Declare a C# interface |
Coding | mb | Declare a method that returns a bool |
Coding | r | Return |
Coding | rf | Return false |
Coding | rse | Return String.Empty |
Coding | rt | Return true |
Coding (if/else) | en | Equals null |
Coding (if/else) | ese | Equals empty string |
Coding (if/else) | ifb | if block |
Coding (if/else) | ifn | If variable is null |
Coding (if/else) | ifna | If variable is null assign |
Coding (if/else) | inen | If variable is not null |
Coding (if/else) | lb | Else block with braces |
Coding (if/else) | li | Else if |
Coding (if/else) | ne | Not Equal |
Coding (if/else) | nen | Not equal to null |
Entity Framework | aspdbc | Register DbContext |
Entity Framework | dbc | DbContext class |
Entity Framework | dbcf | Create DbContextFactory |
Entity Framework | dbs | DbSet<T> |
Exceptions | ian | If argument null throw |
Exceptions | ians | If argument is empty string throw |
Exceptions | tane | Throw ArgumentNullException |
Exceptions | tcb | Try catch block |
Exceptions | tnie | Throw not implemented exception |
Exceptions | tnioe | Throw invalid operation exception |
Exceptions | uitrywin | User interface try catch |
Methods | mf | Method that returns an float |
Methods | mi | Method that returns an int |
Methods | mm | Method that returns a type of your choice |
Methods | ms | Method that returns an string |
Methods | mv | Method that returns an void |
Miscellaneous | adp | Adapt property |
Properties | ap | Auto-implemented property |
Properties | apb | Auto-implemented bool property |
Properties | apf | Auto-implemented float property |
Properties | api | Auto-implemented int property |
Properties | aps | Auto-implemented string property |
Properties | p | Property |
Properties | ps | Property (string) |
Properties | rb | Read-only bool property |
Properties | ri | Read-only int property |
Properties | rp | Read-only property |
Properties | rs | Read-only string property |
Strings | nsb | Create a new StringBuilder |
Strings | se | String.Empty |
Strings | stf | String.Format |
Strings | stp | String.Format with paste |
Unit Testing | aaa | Add Arrange Act Assert comments |
Unit Testing | ae | Assert AreEqual with T |
Unit Testing | ae0 | Assert.AreEqual to 0 |
Unit Testing | aep | Assert.AreEqual on two properties |
Unit Testing | aepb | Assert.AreEqual on two boolean properties |
Unit Testing | aepd8 | Assert.AreEqual on two DateTime properties |
Unit Testing | aepf | Assert.AreEqual on two float properties |
Unit Testing | aepi | Assert.AreEqual on two int properties |
Unit Testing | aeps | Assert.AreEqual on two string properties |
Unit Testing | aes | Assert.AreEqual on two strings |
Unit Testing | af | Assert.IsFalse |
Unit Testing | afa | Assert.Fail() |
Unit Testing | ain | Assert.Inconclusive() |
Unit Testing | aines | Assert string is null or empty |
Unit Testing | an | Assert is null |
Unit Testing | ane | Assert is not equal with choice of T |
Unit Testing | ane0 | Assert is not equal to zero |
Unit Testing | anef | Assert floats are not equal |
Unit Testing | anei | Assert ints are not equal |
Unit Testing | anepb | Assert bool properties are not equal |
Unit Testing | anepi | Assert int properties are not equal |
Unit Testing | aneps | Assert string properties are not equal |
Unit Testing | anes | Assert strings are not equal |
Unit Testing | anese | Assert string is not empty string |
Unit Testing | ann | Assert is not null |
Unit Testing | anns | Assert is not null or empty string |
Unit Testing | ans | Assert is null or empty string |
Unit Testing | ase | Assert.AreEqual to String.Empty |
Unit Testing | at | Assert is true |
Unit Testing | mvt | Test Method |
Unit Testing | oti | On Test Initialize method for MSTest |
Unit Testing | otisutn | On Test Initialize method that sets system under test to null |
Unit Testing | sut | SystemUnderTest property for unit tests |
Unit Testing | sutn | Set SystemUnderTest variable to null |
Unit Testing | tc | Create test class |
Unit Testing | tf | Create test class |
Unit Testing | tfsut | Create test class with system under test property |
How to Install the Snippets for Visual Studio Code
To install these, open up Visual Studio Code, bring up the list of commands (CTRL-Shift-P / Command-Shift-P), and search for Configure User Snippets. This will bring up your snippets info. Choose ‘csharp’ and then copy the my snippets into your csharp.json snippets file. You could also just replace your csharp.json snippets file with my file if you don’t already have any snippets that you’ve written.
![Code snippets for mac free Code snippets for mac free](/uploads/1/1/2/1/112194283/523345538.jpg)
How to Install the Snippets for Visual Studio 2019
To install these snippets for Visual Studio 2019, first make sure that Visual Studio is not running. Then you’ll need to copy the snippets to the snippets folder using Explorer.exe. The folder name is %userprofile%DocumentsVisual Studio 2019Code SnippetsVisual C#My Code Snippets. If you’ve never customized a snippet in Visual Studio before, this directory might not exist. Just create it and copy the snippets to that directory.
How to Install the Snippets for Visual Studio for Mac
To install these snippets for Visual Studio for Mac, first make sure that Visual Studio for Mac is not running. Then you’ll need to copy them to the snippet folder using Finder. The folder name is ~/Library/VisualStudio/8.0/Snippets. If you’ve never customized a snippet in Visual Studio for Mac before, this directory might not exist. Just create it and copy the snippets to that directory.
Summary
Anyway these snippets make my life as a developer a lot easier. Hopefully, you’ll get some use out of them. If you want to download them from GitHub or want to contribute, here’s the GitHub repository.
Hope this helps.
-Ben
Reading Time: 2minutesEvery programmer, engineer, or computer science student needs a software tool to store their code. It is an essential aspect of any activity since a huge number of snippets need to be systematized. You can’t work effectively in a big team if you do not organize your daily workflow. Here are the 4 best snippet mac managers that you should pay attention to. Let’s check them closely.
CodeBox
CodeBox is a relatively comfortable and multifunctional tool for any programmer and a computer science student. The point here is that there are enough functions for sharing code, searching folders, managing fragment libraries, and breaking down files by tags and groups. You can create various smart groups and use syntax highlighting for 100 programming languages. Tools for daily work allow you to organize all your files in one place.
SnipperApp 2
This multifunctional app is suitable for a broad audience of users. First of all, it is interesting for its great interface with minimal resource consumption and convenient systematization of all snippets into directories and folders. Each user can synchronize their work time, and use GitHub gist. Here are some more advantages of this app.
- Syntax highlighting for 120+ languages;
- GitHub Flavored Markdown with preview mode;
- Dark and light themes;
- Showing of line numbers.
The best code snippet manager has available subscription models and a free version. It allows you to create up to 5 unique tags and store snippets locally. It is very convenient for those programmers who want to test all the advantages of using such a tool for Mac OS.
Snippet Manager
It is another representative of the snippet manager’s family. It contains a simple interface and allows you to configure cloud synchronization. These are useful tools for beginners who learn the profession of a programmer and study at a university. Users can create a large number of snippets, rename or delete them to free up more space. It has basic functionality, but it is enough for beginners.
Snippely
It is an old code snippet manager that is available to every user for free. It functionality includes editing, creating notes, and individual fragments with support for various programming languages. The interface is still relevant to the modern requirements of work management. The application allows users to work on projects of any complexity and is suitable for small teams of programmers.
You Might Also Like
Code Snippets For React Visual Studio Code
- The Modern Manager: Wanna Be a Rockstar Manager?In episode two of Mamie Kanfer Stewart´s The Modern Manager podcast, “What It Means to…
- The Modern Manager: Are You an (Un)intentional Manager?Take some time to reflect on how you´re doing as a manager with this first…
- The Modern Manager: Being a 'Human' Manager with Erica KeswinHave you ever felt like your work activities feel more like transactions than relationships? Mamie…
- Strauss Brands Welcomes New Livestock ManagerThird-generation family-owned and -operated meat company, Strauss Brands, is proud to welcome new livestock manager, Mackenzie…