Category: Web Design – Javascript

Convert HTML to Markdown

One of my biggest mistakes with this blog was not finding a WordPress plugin that would allow me to write my posts with markdown; to this day I still need to write posts in “Visual” mode and then manually convert the post to HTML for “Text” mode.  One of these days I want to convert existing posts to Markdown and then enable a plugin that…

Setup React Hot Loader in 10 minutes

Photo by Riku Lu on Unsplash Several years ago, it was becoming tiring (and annoying in the case where the changes do not render as expected) to refresh the browser to see the most recent updates on a web project. In a bid to solve this problem, developers created several plugins and tools that can cause the DOM to re-render on each save without even doing…

Preferring code over comments

I think we’d all agree that code comments are a good way to document code that is otherwise hard to follow. Sometimes there’s just no way to make the code as clear as you’d like and a comment is a good solution. That said, comments have one large issue: they can get out of date. An outdated comment that is incorrect could cause you to…

How to Create a Mall Map with Real-time Data Using WRLD

This article was created in partnership with WRLD. Thank you for supporting the partners who make SitePoint possible. As a web developer, you sometimes find yourself in a position where you are required to implement a map. Your first choice is to use Google Maps, right? This looks okay. However, you may be required to overlay additional information over the map with the help of…

Get React Component Data by DOM Node

Retrieving a React component’s DOM node is fairly simple from within the component itself, but what if you want to work backward:  retrieve a component’s instance by DOM node?  This is a task that the old Dojo Toolkit’s Dijit framework allowed with the dijit.byId method, so it made me think if you could do the same with React.  It turns out you can retrieve a…

Tutorial: Use IPFS in the Browser

This tutorial will help you exchange files between browser nodes and go-ipfs or js-ipfs nodes! Note: As js-ipfs@0.29.0 currently doesn’t support DHT peer discovery, the peer from which you are fetching data should be within the reach (local or in public IP) of the browser node. That being said, we will explain how to circumvent these caveats and once they are fixed, we’ll update the…

Habits of Successful React components

One of the best features of React, and one of the reasons I think so many people love using it, is that it gives you the freedom to choose what approach you’re going to take. As a primarily view based library, React provides no out-the-box opinions on how you make HTTP requests, how you style your components, what naming conventions to use, and so on….

Interactive Data Visualization with Modern JavaScript and D3

In this article, I want to take you through an example project that I built recently — a totally original type of visualization using the D3 library, which showcases how each of these components add up to make D3 a great library to learn. D3 stands for Data Driven Documents. It’s a JavaScript library that can be used to make all sorts of wonderful data…

Detect WebVR Support with JavaScript

It’s been two years since I was heavily involved with WebVR at Mozilla but, despite not contributing every day, I can see VR making leaps and bounds, from Firefox making an increased effort to Chrome pushing VR and Oculus and HTC (Vive) improving their offerings.  Native games are getting better but, more importantly, browsers are getting faster and three.js and aframe are empowering incredible VR…

async-ratelimiter – Rate limit made simple, easy, async.

Rate limit made simple, easy, async. Based on ratelimiter. NOTE: It requires Redis 2.6.12+. Install $ npm install async-ratelimiter –save Usage A simple middleware implementation for whatever HTTP server: ‘use strict’ const RateLimiter = require(‘async-ratelimiter’) const Redis = require(‘ioredis’) const limit = new RateLimiter({ db: new Redis() }) const apiQuota = async (req, res, handler) => { const limit = await rateLimiter.get({ id: req.clientIp })…