Display custom HTML, CSS, and JS inside VS Code

Woman using laptop
Woman using laptop
Photo by Christina Morillo on Pexels.

It’s weird how there aren’t enough tutorials online about building a VS Code extension. I’m someone who always relies on a mix of Stack Overflow and YouTube tutorials, so it took me quite some time to figure out how to build a VS Code extension in order to save snippets.

One thing I really got stuck on was adding a webview. Users wanted to see the snippets they had saved inside VS Code. I thought a tree view would be the right fit. The documentation scares you from using the webview API, warning that it can slow down the application…

“I’m going to learn to code.”

If you’re like me and love to make everybody sweat about their new year’s goals, this is something you hear a lot. And just like any other resolution, not many people give it another thought by the end of January.

It could be one of those New Year’s Resolutions are made to be broken things. But of course, that’s not just it. Learning to learn how to code is much harder than actually learning to code.

So if you’re somebody who’s never coded before, here’s 3 things that I think will help it become…

The code snippet manager you’ve been waiting for

Image credit: Author

If you want to get straight to it, the best tool to save code snippets is thiscodeWorks.com.

About two years ago when I was learning to code, I was spending way too much time searching for snippets on Google and a little too much time writing down those snippets that worked into my notebook.

Why not use a notes app you say? I tried them. I did. But they’d disappear. Just like my notes, my snippets would get buried and disappear below new snippets that’d get saved at the top. What I liked about writing them was I could flip…

And block http requests if you don’t want to redirect them

I had figured out automatic SSL Redirects from HTTP to HTTPS for Heroku before. That was where all HTTP requests in the browser would redirect to HTTPS. But when I started experimenting with API’s, I found out that didn’t work.

And I didn’t even want all the HTTP requests to get redirected/blocked either. Just some routes with sensitive data. So once again I went down a rabbit hole, one that didn’t have much info online. And now that I’ve figure it out, thought to share any poor soul who was in the same place I was 20 mins ago :D

This is what an embedded snippet will look like:

Step 1: Save the code snippet

On thiscodeworks.com or with the Save Code extension.

Step 2: Copy the URL of the snippet you want to embed.

You can get it from the address bar at the top of your browser.

Step 3: Paste the URL in your blog & press enter

After a few seconds, your snippet should auto-embed in the blog!

That’s all! :D

Note: This won’t work for private snippets.

Here’s a video as well:

Feedback and suggestions welcome!

Email us at info@thiscodeworks.com with your suggestions on how this embedded snippet could be better.

A tutorial on how to keep user sessions saved when Heroku restarts the server so they don’t log out.

This is for Node.js, Express and express-session on Heroku.

I’m embarrassed to admit it took me over a year to realize that users were getting logged out daily. Nobody complained and I’m used to testing from different accounts so I never noticed.

Until I started work on a Chrome extension that required you to always be logged in to the website. So I looked into the cookies, extended the maxAge to 2 weeks. That should do it.


Somehow users were still getting logged out. And I still didn’t notice. That is until I got an angry Discord message from…

scss compile automatically node.js
scss compile automatically node.js

When I first started to learn web development, I learnt the good old HTML, CSS and Javascript. And they were adequate. Good enough to help me build and launch some projects online.

But after a year of coding, I came across SASS and fell in love with it. It just made all my CSS styles clean and organized, and quickly became my default setting for any new project.

And while it was a joy to use in my new stuff, I would instantly be put off when editing old projects. So many lines of code to sift through. Where are…

As somebody who loves meeting people, going out and dressing up, I would never have chosen to work from home. Yet I couldn’t been happier.

It all started when I was a bored student at university. My degree was super easy and I had a lot of free time. I did a bunch of stuff on the side to stay busy, and one of those was earning some money from freelance writing.

Photo by 白 晓东 on Unsplash

When the time came to graduate, one of my clients offered me a full-time remote job in marketing. Of course, I wasn’t going to be picky when jobs were scarce for a fresh graduate so I happily accepted.

My new boss was great and to this day we’re still friends, but I must…

Three code snippets which I think are truly fascinating and have changed the world in recent history.

I don’t know about you, but back in school when we would study History it was the history of civilizations. From Alexander the Great to the rise and fall of the British Empire, I learned all there was about great leaders of the past and how each era impacted history.

But the inventors who really changed the way we live were just names to memorize in Science class. Graham Bell invented the telephone in 1876. Thomas Edison built the first lightbulb in 1879. The Wright Brothers pioneered aviation in 1903. …

I was one of mLab’s happy customers until one fine day I got an email announcing that they’d been acquired by the more established mongoDB. Good for them (and us) I thought, until I read further down that all customers would have to migrate within the next year.

Ugh, great…

Databases has never been my forté. The less I deal with them the better. All that I know is from Googling & figuring out my problems along the way. So I avoided it as long as I could. But my website thiscodeworks.com


Creator of thiscodeworks.com \n Follow me @mishkaorakzai on Twitter. I write at mishka.codes

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store