Here you can find my private notes about programming that I wanted to share with you. Feel free to filter based on the topic you want or search for something specific.
Use the JavaScript ES6 Backtick (Template literal) feature to write multiline strings in HTML code
The ES6 specification of JavaScript and of course the TypeScript language, provide us the template literal syntax (the `` characters). With the template literals we can write multiline strings in JavaScript without having to use the old syntax. Take a look at the following example:
vartestString="Lorem ipsum dolor sit amet, \\nconsetetur sadipscing elitr, \\nsed diam nonumy eirmod tempor \\ninvidunt ut labore et dolore";
Possible causes of the "Mobile Usability > Content wider than screen" error message in Google Webmasters page
If you use the Google Webmasters for your webpage then you most probably have seen the Mobile Usability page under the Search Traffic menu. In this subpage Google lists for you CSS, HTML or SEO errors that have to do with the mobile version of your website. One of the most common errors that is listed there is the Content wider than screen error.
Software Architecture with JavaScript - In which part of your code should you do sanity & validation checks to your data?
When working in an application which is divided into multiple architectural layers, it is often the case that the developers of a team do not trust the data their function get in one layer from a function in the same or in an another layer. For that reason they often add null checks (very common in C#) or in JavaScript’s case they add if (variable) {...} checks (implicit cohersion of values in an if clause) in order to catch an error before it happens and avoid breaking the execution of the code.
But is it that bad for a function to fail or is it that bad for your application to throw an exception when something did not go as it is supposed to go?
How to speed up the compilation of your Jekyll website when you use npm modules
Chances are high that you are going to use plugins from npm in your Jekyll website. For example you might want to minify the CSS files by using Gulp, or bundle together your JavaScript files with Webpack.
A new node_modules folder is going to be created on the root of your website and now all of a sudden your website need much more time to be build when you start the development-server with Jekyll serve.