Technical Blog from TekMi

Everything related to Web Development, including Typescript, React, Gatsby, Node, PHP, Symfony, Laravel and many more

Read articleExplore Series 
|10 min read |Typescript|
Adam
Adam

New Feature: ts-expect-error

TypeScript has been evolving steadily since 2012, the year when Microsoft announced its first public preview. With the TypeScript 3.9 version released in May 2020, a new directive, among other features, has been made available to TypeScript developers. While having slight similarities to , is more sophisticated and does additional code analysis that wasn't possible before. If you are interested in knowing more about it, let's evaluate it together. Prerequisites NodeJS Long Time…
Read More
Explore "typescript-evolution" Series
|6 min read |Typescript|
Adam
Adam

Importing JSON file using ES Modules

I wanted to import a JSON file using ES Modules default import syntax inside my TypeScript application, but... Prerequisites NodeJS Long Time Support (Version 12.x) NodeJS Package Manager (Version 6.x) TypeScript (Version 3.9.x) The settings.json file with the valid JSON content: TL;DR Solution Repository: https://github.com/tekmi/prodding-typescript/tree/master/esm-default-import-json-file Life without TypeScript ES Modules (ESM), next to other module systems (i.e.: AMD, UMD, and…
Read More
Explore "prodding-typescript" Series
|5 min read |Typescript|
Adam
Adam

Cannot Find Name "require"

I wanted to use NodeJS require directive to read a JSON file inside my TypeScript application, but... Prerequisites NodeJS Long Time Support (Version 12.x) NodeJS Package Manager (Version 6.x) TypeScript (Version 3.9.x) The configuration.json file with the valid JSON content: TL;DR Solution Repository: https://github.com/tekmi/prodding-typescript/tree/master/cannot-find-name-require Life without TypeScript NodeJS, which uses CommonJS module format, offers a simple way to read JSON files…
Read More
Explore "prodding-typescript" Series
|12 min read |PHP|
Adam
Adam

How to prepare Ubuntu 18.04 VPS to run Symfony 5 application on Apache 2.4 with mod_php

In case you never heard about Symfony, it is a PHP framework to create websites and web applications. It comes with over 50 reusable components that power many well-known PHP applications, such as Drupal, phpBB, and eZ Publish. The Symfony release cycle is pretty predictable and follows a time-based model. Major versions come out every two years, while minor versions every six months. At the time of writing, the latest stable release is Symfony 5. However, having a good framework is…
Read More
|5 min read |Typescript|
Teklog
Teklog

How to bundle many TypeScript files using SystemJS

TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. You can install it from Node Package Manager (NPM) and tinker with its executable. It accepts a handful of options which may be stored inside tsconfig.json configuration file. SystemJS is a JavaScript module loader that allows using ES Modules in all browsers. You can get it either via CDN or from Node Package Manager. You may be wondering why do we even talk about SystemJS and Typescript together…
Read More
|11 min read |Gatsby|
Teklog
Teklog

How to create Single Modal in Gatsby using Reactstrap, React Portals, React Context and React Custom Hooks

Gatsby is a free and open-source static site generator based on React. In this tutorial, we will use the default starter kit with cosmetic modifications. Reactstrap provides React components based on Bootstrap 4 library. It comes with a powerful Modal component and his three supporting sub-components: ModalHeader ModalBody ModalFooter Armed with those, you can get a working Model almost in no time. Reactstrap documentation is full of examples, so feel free to explore its Modals part…
Read More
|2 min read |Javascript|
Adam
Adam

Firefox and Chrome Developer Tools - how to go beyond console.log

Both Firefox and Chrome provide some sort of Developer Tools for technical users. Additionally, both browser vendors regularly improve their tools and surprise us with brand new features. In today's post, we are going to talk about console logging. It's the most basic debugging tool and an indispensable companion of any Javascript developer.  But did you know that there is actually much more than a simple console.log command? The good news is that browsers support more methods for…
Read More
|19 min read |Reviews|
Teklog
Teklog

In-depth review of Irresistible APIs: Designing web APIs that developers will love

This blog post is a starting point for a series of in-depth book reviews. I read around 10-15 books a year, I know how much time it cost and how crucial it is to pick up the right one. If you are investing your own money in a book, it's even more important to get as much information as possible. You want to be sure that you are not buying a pig in the poke. Before scheduling anything to read, I search for recommendations and reviews in the following places. Goodreads Publisher…
Read More
|8 min read |PHP|
Teklog
Teklog

PHP 7.2 and Argon2 Password Hashing

PHP 7.2 version appeared for the first time on 30th of November 2017, Time goes fast and more than a half year later, on 21st of June 2018, PHP announced 7.2.7 patch release. Among all the new features introduced in PHP 7.2, there is one, namely Argon2 Password Hashing, which will be the topic of our today's post. Let's explore this great addition together and verify whether Argon2 is a good contender to Bcrypt or not. As always, all the other features of PHP 7.2 can be found under…
Read More
|2 min read |PHP|
Teklog
Teklog

PHP 7.2 and Allow Abstract Function Override

PHP 7.2 has been released on 30th of November 2017. The most important features have been listed out and briefly described, however there is much more to be explored. Without further ado, let's dive into Allow Abstract Function Override together. Assumptions Docker is installed. Try it yourself Clone blogging-phplatest repository Run docker container, based on the php 7.2.0 CLI Stretch Container Explanation As presented below, Mammal::run method has broaden the $speed parameter type…
Read More
|2 min read |PHP|
Teklog
Teklog

PHP 7.2 and Object Typehint

PHP 7.2 is around the corner.  On the 26th of October 2017, the 5th version of PHP Release Candidate has been announced, which was preceded by 3 alpha, 3 beta and 4 RC versions. First alpha version was announced on the 8th of June 2017 and the final version is about to be released by the end of November 2017. If you are impatient and curious as I am, it's right time to take a sneak peak at what PHP team is cooking for us. You can track all implemented features by studying PHP…
Read More
|4 min read |Javascript|
Teklog
Teklog

Modern JavaScript syntax - ES6 const variables

ES6 brought lots of new features. Among them is support for constants. Instead of using var while declaring variables, you are now free to choose between const and let. In this tutorial I will focus primarily on const and its "immutability" quirks, while let will be tackled in the following one. Without further ado, let's start it off by going through the handful of examples. Assumptions Familiarity with Codepen, JSFiddle or JSBin Familiarity with Browser Developer Tools Example I…
Read More
|6 min read |Javascript|
Teklog
Teklog

How to start using modern Javascript syntax within minutes

Everyone, including browsers, got used to the JavaScript syntax from 90-ties. But time passes by and JavaScript becomes more and more popular, so ECMA, the committee behind the changes in JavaScript, woke up and started to release new features. The most recent major update to the specification was approved on 17th of June 2015 and is called by many names: ECMAScript 6, ES6, ES2015, and ES6Harmony. Based on current plans, new specs will be released on a yearly cycle. Please monitor…
Read More
|5 min read |Laravel|
Teklog
Teklog

How to configure Browser Sync live reloading in your current or next Laravel project running on Homestead Virtual Machine

Browser Sync is an open source tool that can instantaneously synchronize your code changes with your browser. As soon as the file is saved, automatic webpage reload happens, without any action from your side. You could use Browser Sync outside Laravel and without Laravel Mix asset bundler, however in this tutorial I will focus primarily on how to harvest its greatest features with truly minimalistic configuration. All the hardest work has already been done by Laravel Mix, which lets…
Read More
|12 min read |Laravel|
Teklog
Teklog

Is it beneficial to add Laravel Collective HTML package into your Laravel project?

Laravel Collective is a set of components that have been removed from Laravel's core framework and are no longer maintained by Taylor Otwell. Instead there is group of volunteers who decided to maintain following once famous packages: laravelcollective/annotations - allows to use annotation in PHP Docblocks, such as (@Hears, @Get, @Middleware) laravelcollective/html - delivers Form and Html conveniences (via HtmlBuilder aka Html facade and FormBuilder aka Form facade…
Read More
|12 min read |Laravel|
Teklog
Teklog

How to configure Push to Deploy with Envoyer

It's hard to not stumble across Envoyer, once you become the member of Laravel community. It's advertised as Zero Downtime PHP Deployments and is one of many commercial products from Taylor Otwell, creator of Laravel framework. I will walk you through the configuration of Push to Deploy. This means that whenever you push or merge your code into specified branch, Envoyer should detect it and automatically trigger deployment. Keep in mind that Envoyer allows one project to be…
Read More
|3 min read |Laravel|
Teklog
Teklog

How to replace Vue.js with React in Laravel 5.4

As you probably experienced, Laravel 5.4 comes with Vue.js bundled and bootstrapped. For some developers it is equivalent of Laravel being coupled with Vue.js in some way. Hopefully it's not the case. Laravel is completely agnostic when it come to JS frameworks and you are free to choose whichever you prefer. Keep in mind though that Laravel community somehow fell in love with Vue.js, what is indirectly proven by following facts. Upcoming conferences Laracon US and Laracon EU will…
Read More