Displaying and escaping characters in Hexo

Hexo has a simple method for displaying characters that need to be escaped; using the raw and endraw tags. It’s possible to use the backtick character provided by Markdown to display the special characters and Hexo provides the {% raw %} {% endraw %} option to capture raw information not to be interpreted by Hexo, but hexo cannot support all strings. Like in the case of mixing the backtick ` statements provided by Markdown. The trick to be able to display any backticks (`) is a combination of the raw and endraw as well as using multiple backticks.

# Here is a codeblock using 3 backticks
# Render a backtick in Hexo
``{% raw %} `{% endraw %}``
# Rendering {% raw %} and {% endraw %} in Hexo
`{% raw %} {% {% endraw %}{% raw %}raw %} {% {% endraw %}{% raw %}endraw %}{% endraw %}`

CMDER on Windows causing Lock files in Git, and the fix

An issue can occur when working within CMDER when Git complains that an index.lock file exists and cannot continue. This happens to be an annoying bug in Windows and CMDER. To immediately fix this issue in Windows, the task manager must be opened and all git-for-windows processes need to be ended. Then the index.lock file can be deleted manually. Or… the bug can be fixed instead!

Read More

Modernizing Web Application JavaScript

Refactoring is a process of revisiting code and attempting to make it ‘better’. The code is no longer useful due to its age, functionality, or preference and it has been decided to be replaced with an equal set of ‘better’ code. At no point does a developer learn the best way to refactor code. Refactoring is a skill learned through experience. JavaScript refactoring is notoriously hard due to scope and dynamic accessing of object properties. There is a clear pattern, however, that can be followed that promotes success and is pragmatic.

Read More

Trimming Strings; Stripping Text in JavaScript

Strings are one of the most basic structures in any development language. Developing with strings happens in common ways across languages. Sometimes languages don’t offer the common gamut of tools and leave the developer to implement their own methods. One of these cases occurs with a proper strip method in JavaScript. JavaScript added the String.Trim[1] with EcmaScript5, which is a specialized version of a generic strip, so that leaves developers to implement it themselves.

Read More

The HTML5 Input Event

In the DOM a special event occurs on an <input> or <textarea> element known as the change event [1] [2]. The change event gives a developer the ability to catch input changes. However, it falls short when instant feedback is needed because it will only trigger once the input has lost focus. Immediate feedback could be handled using the keydown or keyup events. Those events are costly (happening often and requires the code to keep state to know of changes actually occurring) and are potentially buggy due to extra logic needed.

Read More