#VS2017 – HowTo: Share code from IDE in #Gist with a single click!


Hi !

For a while I decided to stop sharing code using “text” in my blog. I used to share a screen shoot of the code and then a link to the full example on GitHub. This seemed like a good idea, because on several occasions I had had unfortunate comments from people who performed a “copy & paste” portions of code from my blog, without even reading the complete sample.

Well, a while ago, a blind developer complained about those who shared code with images. And of course, after meeting a blind person who shared with me how he program every day, I did an evaluation and decided that it was best to go back to share code in text mode. (BTW: I wrote about this a while ago)

One of the best platforms for this is the Gists from GitHub, which gives us all the experience and appearance of GitHub. Yes, if you look for the option of doing it from the IDE, the next extension is more than useful Gists for Visual Studio.

The way to use it is quite simple, the Code Editor displays the context menu and you will see the new option “Create a new gist”



The first time we use the extension, we must authenticate in Gists. After this, the next step is to define the name of the file, a description and if we want to share all the code of the file we are working on or just the selected text.


The extension will create the Gist and share back the Url of the created one.


Sample output for the post:

public async Task ConnectAsync()
_client = new TcpClient();
await _client.ConnectAsync(_address, 5555);
_stream = _client.GetStream();
// unlock the brick (doesn't actually need serial number?)
byte[] buff = Encoding.UTF8.GetBytes(UnlockCommand);
await _stream.WriteAsync(buff, 0, buff.Length);
// read the "Accept:EV340\r\n\r\n" response
int read = await _stream.ReadAsync(buff, 0, buff.Length);
string response = Encoding.UTF8.GetString(buff, 0, read);
throw new Exception("LEGO EV3 brick did not respond to the unlock command.");

Happy Coding!

Greetings @ VSLive en Austin

El Bruno


Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: