-
How to Fix: Could not establish connection. Receiving end does not exist
May 08 2019
If you are developing a Chrome extension with message passing, then you might have received the following error: Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.
-
How to Setup Search on Hugo
Mar 04 2019
Here's how to setup search using lunr on your static Hugo your Jekyll site
-
JWT Tokens in Express and NodeJS
Apr 22 2018
The JSON Web Token (JWT) is the easiest standard for protecting APIs and passing in claims data. A JSON Web token allows the server to verify the authenticity of the user and provide them access to protected API routes and data. A simple JWT flow goes as follows:
The user sends login credentials to the server The server verifies user against the database then returns a JWT token if valid The user sends that token in the header with every request to API.
-
React Login with Google Firebase
Apr 04 2018
There are many opinionated solutions for building a React Login with Google Firebase. I generally prefer an approach where the user isn’t shown the main UI until he is logged in. And if the user logs out, we immediately kick him back to the login screen. Luckily, this isn’t hard to do at all.
Dependencies The only dependency you will need is the Firebase API. You can install this form the Node Package Manager.
-
How to build a Chrome Extension
Mar 28 2018
Chrome extensions are really cool. They allow the user to extend the capabilities of their browser and can incorporate really well into existing apps. So let’s take a look at how to build a Chrome Extension in less than 10 minutes. Chrome Extensions are written in Javascript, so I recommend that you have a basic understanding of Javascript before proceeding with this tutorial.
What we’re building We are going to build a simple chrome extension that will allow you to search google for any text that you highlight on a page.
-
Google Poly API Javascript and NodeJS
Mar 26 2018
Google has been working on an interesting project called Poly. With Poly, you have access to hundreds of 3D objects that can be used to build VR games or with AR content. The interesting about Poly is that all of the graphics are available on demand. Think of it like Google Fonts just for 3D objects. So let’s take a look at how you can get started with Google Poly API Javascript and NodeJS bundle.
-
React Context API
Mar 22 2018
I’m sure you have probably heard of the fancy new React Context API. It’s a new way for you to manage application state. If you are building a large react application, you have probably encountered a problem where you needed to access and share data across multiple components. For example, we might have information on the currently authenticated user that multiple components need information on. To solve this issue, you might use a library like Redux or Mobx.
-
Typescript Getter and Setter
Mar 07 2018
This is something that you probably don’t ever think about, but getters and setters are implicit on every javascript object. For example, if we take the following:
person = {}; person.name = 'Dave' //uses the implicit setter on the object console.log(person.name) //uses the implicit getter The above code is something that you have probably have seen very often in javascript. However, this doesn’t give you much control over how properties are accessed or defined.
-
Angular 4 input only numbers Directive
Mar 07 2018
I was working on a project in Angular 4 and needed to implement input fields that only accept numerical values. My first thought was to simply add the HTML5 type=”number” to the input. Unfortunately, this isn’t supported in Internet Explorer 10 and some of the clients would most likely be using Internet Explorer 10. My only other option was to implement a directive. Thanks to this StackOverflow answer, I was able to modify it to my needs.
-
Implementing Token Interceptor and Retry in Angular 4
Feb 23 2018
If you are building a web application using Angular 4 or Angular 5 there’s a good chance that you might be working with JWT tokens. Luckily, implementing token interceptor and retry in Angular 4 and beyond is very easy thanks to the new HTTP Interceptors. Using this, we can add an authorization header to every outbound request while also implementing a retry mechanism for requests that fail due to an expired token.
-
Implementing Token Interceptor and Retry in Angular 4
Feb 23 2018
If you are building a web application using Angular 4 or Angular 5 there’s a good chance that you might be working with JWT tokens. Luckily, implementing token interceptor and retry in Angular 4 and beyond is very easy thanks to the new HTTP Interceptors. Using this, we can add an authorization header to every outbound request while also implementing a retry mechanism for requests that fail due to an expired token.
-
Simple CSS Hack Can Steal Internet Passwords
Feb 21 2018
A user on GitHub just posted an alarming exploit shows how a simple CSS hack can steal internet passwords. It’s kinda funny how you wouldn’t really think of CSS when it comes to vulnerabilities and hacking. Since CSS is only used to style a webpage, its threat level is generally considered to be relatively low.
However, CSS does provide developers with very advanced selectors. In this case, if you wanted to select an input with the value of A in it and turn it red, then CSS allows you to do that.
-
How to build a forum
Feb 20 2018
Practically every online community has a forum. It makes sense though because forums are a great way to facilitate online discussion. Now let’s say that you wanted to build your own online forum. Well, building a very basic forum wouldn’t be too complicated. Just script together some PHP with an MYSQL database and you will be all set. Unfortunately, this would likely leave you vulnerable to many potential security holes and a terrible user experience.
-
Angular 4 Forms
Jan 13 2018
One of my favorite features in Angular are forms. Using Angular 4 forms or Angular 5 forms are very helpful because they provide for quick validation and object mapping. Here’s how you can create a basic angular 4 form (also works with angular 2, and angular 5).
HTML You will also notice that I am using Bootstrap for some styling, that is completely optional. Let’s look at the form HTML:
-
Bootstrap Navbar Collapse in ReactJS
Dec 27 2017
Bootstrap is an amazing library and works wonders with ReactJS. Unfortunately, you can’t (or really shouldn’t) use Bootstrap.js with React because bootstrap directly manipulates the DOM; which could break React’s nice rendering flow. This becomes a big problem if you wanted to implement a Navbar using plain bootstrap. Take the following for example from Bootstrap’s documentation:
You could directly take this code and put it in ReactJS (but change class _to _className) and you will have a working Navbar.