VS Code – snake_case to camelCase

VS Code doesn’t currently provide a built-in way to convert cases like snake_case, camelCase or TitleCase. Here’s a keyboard focused workflow to handle snake_case to camelCase conversion:

Some Background

I began one of my web apps using snake_case for class and function names. It turns out, a lot of JavaScript apps and tool-kits use camelCase and I wanted other users to feel comfortable using the app alongside those. So I wanted to convert cases. In editors like Vim or Sublime Text, it’s super easy. I’d been using VS Code, which required a workaround, resulting in the workflow above.

More Discussion

I posted the same workflow here as well:
https://github.com/Microsoft/vscode/issues/12185#issuecomment-414411370

In that discussion, user @jpike88 provides an alternative explanation that follows the same line of thought. The difference is just that the workflow I posted focuses on key-presses, no mouse interaction needed. I thought Vim users might find that more natural. Either way, I think both explanations work together to help get the workflow idea across.

Hope it helps. 🙂

Advertisements
VS Code – snake_case to camelCase

Scanline theme for Hyper terminal

Hyper.is is a terminal built on web technologies, namely Electron. As such, it can be customized using CSS. Here’s a screenshot of Hyper with scanlines, made possible through CSS:

hyper-scanlines.png

And here’s the config file for that:

To use it:

  1. Open Hyper terminal and press CTRL , to open preferences file.
  2. Copy and paste the code above to replace existing preferences (or just copy-paste over the ‘css’ section.

That’s it.

NOTE: The subtle scanline animation is a bit of a drain on the CPU but it can be disabled  replacing line 89 with ‘animation: none;’

 

Scanline theme for Hyper terminal

Krita on Elementary OS

Krita is a stunning, open-source drawing and image editing application that works a lot like Photoshop. Til recently, it hasn’t been available out-of-the-box for Elementary OS. There were certain dependency requirements that couldn’t be met by default, but that’s now been addressed with AppImage!

Check out the bottom of this article for info: Krita 2.9.11 and the second 3.0 alpha build

Get Krita running on Elementary OS

All you need to do to run Krita on Elementary OS now is download the AppImage file (mentioned in the above article), set the properties so it’s executable, then run it. Dead simple!

Here’s a quick rundown:

  1. Download kkrita3-prealpha2-3c69a59-x86_64.appimage
  2. Right-click the file and select Properties.
  3. Click the More tab.
  4. Toggle Execute for Owner and Group.
  5. Click the Close button.
  6. Click on the file to run Krita (or right-click the file and select Run).

That’s all there is to it. Finally, Krita for the ultimate OS! 😉

Krita on Elementary OS

How to defeat Beep Beep Bop!

Professing itself as ‘improved’, the evil perpetrator hijacked the seamless and unbroken experience WordPress.com users had come to love. It proceeded to taunt them … “Beep Beep Bop!”

Okay, nuff with the melodrama. Let’s hijack back our improved posting experience. To get back to the traditional WordPress.com post editor, just go to your blog’s /wp-admin/ section like so:

  • yourblog.wordpress.com/wp-admin

You can then make your way to the posting options using the dashboard menu or you can get to the post sections quickly as follows:

  • All Posts: yourblog.wordpress.com/wp-admin/edit.php
  • Add New Post: yourblog.wordpress.com/wp-admin/post-new.php

A little clarification

In case the above is confusing, I’m referring to the ‘improved posting experience’ here on WordPress.com.

Edit Post ‹ D0TH N0T C0MPUT3 — WordPress.com
The ‘improved posting experience’.

Here’s how it used to look.

More improved posting experience
The experience from days of yore.

For those accustomed with the traditional editor, there’s really nothing to gain from the new editor, but there’s a new interface to come to grips with. There’s also a huge loss in that it’s not easy to navigate to other admin sections.

Requests for the traditional editor

It’s possible to access the traditional editor, using the details above. But it seems it won’t be the default anymore, at least from what I understand of this support topic:

https://en.forums.wordpress.com/topic/how-to-permanently-disable-improved-posting-experience

It’s also been discussed at length here:

https://en.forums.wordpress.com/topic/please-reinstate-the-option-of-choice-to-use-the-old-publishing-format/

So for those preferring the traditional post editor, the method outlined above is the way to go. For now, it seems Beep Beep Bop is invincible. But we can sneak our way past his evil grasp.

How to defeat Beep Beep Bop!

Edit GitHub Pages

Here’s a quick guide to editing GitHub Pages. Not familiar with GitHub Pages? It’s a totally free service provided by GitHub where you can freely host HTML pages. Read more about it here: https://pages.github.com/

The Details

GitHub uses a separate branch for those pages so you can access the gh-pages branch like so:

In your GitHub repo, click to open the Branches drop-down.

GitHub branch dropdown

Select gh-pages.

GitHub gh-pages branch

You’ll be switched over to the gh-pages branch, where you should see the files served publicly such as the index.html file.

GitHub gh-pages index.html

Click on the index.html file to open it, then click Edit (pencil) icon to make changes.

GitHub gh-pages edit index.html

Once you’re done with editing, scroll to the bottom of the page and you’ll see a Commit changes button. To save the changes, press that button and optionally leave a comment about the changes.

GitHub gh-pages edit commit

That’s it!

You should see the change(s) reflected when viewing the page in your browser, through the page’s github.io url (or via a custom domain if you’ve set configured that).

The command-line method

Of course, if you’re more comfortable editing through your command-line or linux terminal, it’s very simple. If you haven’t already, clone your repo locally. For example, you can clone my Nibble project like so:

git clone https://github.com/Ugotsta/nibble.git

Once that’s cloned, go to the project folder:

cd nibble

Then access the gh-pages branch using the git-checkout command like so:

git checkout gh-pages

You’ll then be able to see and edit the files from the gh-pages branch. You can make your changes to the index.html file, like so (using Vim) for example:

vim index.html

You can make the changes to the file, then add those files as part of a commit using git add:

git add .

Commit those changes with git-commit:

git commit

The commit process will request a comment, to be added to the changelog. On linux systems, usually Nano is used for the comments.

When using Nano:

  1. Type any comments you’d like to add.
  2. Press CTRL-O to save.
  3. To select and overwrite the file you’re viewing, press ENTER.
  4. Then CTRL-X to return to your terminal prompt.

Now you can push those changes back to the repository with git-push:

git push

that’s it for the command-line!

Here’s a quick syntax-colored summary of those commands:

git clone https://github.com/Ugotsta/nibble.git
cd nibble
git checkout gh-pages
vim index.html
git add .
git commit
git push

I hope that helps, feel free to ask if anything’s unclear. 🙂

Edit GitHub Pages

Fun-themed music visualization with P5.js

I posted about this eerie-themed music visualizer I created using P5.js a fair moment back, and as I noted there, I planned to create more visualizers. Here’s the next in that series, a fun, orange-blue theme to fit my re-launched site at daskitz.ugotsta.com.

Check out the visualizer here: ugotsta.github.io/projects/p5-daskitz.html?url=https://soundcloud.com/ugotsta/grampa-howie

As with my previous one, you can change the ?url= parameter to any SoundCloud track and it’ll play it.

And here’s an example from my recent post for DasKitz:

Still more to come

I do still have plans for more. However, I’m also working on a way to encapsulate the code to make it more extensible. Meanwhile, feel free to alter the code yourself.

Code here: https://github.com/Ugotsta/Ugotsta.github.io/blob/master/projects/p5-daskitz.html

Cheers!

Fun-themed music visualization with P5.js