Friday, April 26

Tag: Web

Web Tricks

4 Uses of JavaScript’s Array.map() You Should Know

From the classic forloop to the forEach() method, various techniques and methods used to iterate through datasets abound JavaScript. However, one of the more popular methods is the .map() method. .map() creates an array from calling a specific function on each item in the parent array. .map() is a non-mutating method in that it creates a new array as against mutating methods which only make changes to the calling array. This can be tricky to remember. In this post, we'll look at 4 noteworthy uses of the .map() in JavaScript. Let's begin!   Calling a Function on Each Item in an Array .map() as earlier stated accepts a callback function as one of its arguments and an important parameter of that function is the current value of the item being processed by the function. This is...
Web Tricks

Getting Started with React Hooks

React Hooks are a great new feature coming in React 16.7. React 16.6 brought some awesome new things like React.memo() and React.lazy and Suspense. The React team isn't stopping there. Hooks are a feature that you'll end up using every single day of your React development. You can give them a try in React 16.7.0-alpha right now and are being discussed in an open RFC. Hooks are great because we get more tools as React developers. If you want to use state or lifecycle methods you would normally have to change to using React.Component and classes. Hooks let us use these features in functional components!   What are Hooks? React Hooks are a way to add React.Component features to functional components. Features like: State Lifecycle Hooks let you use React's features ...
Web Tricks

What’s New in React 16.6

React version 16.6 is out and it comes packed with some useful new features that are very much worth getting excited about. It's a minor release with major features focused on performance optimization. The main new features include: React.memo() React.lazy() static contextType() static getDerivedStateFromError() a number of deprecations in StrictMode Let's take a look into what each of these features adds to React. React.memo() React.memo() is the functional component solution to React.PureComponent as used in class components. It's a higher order component that is wrapped around functional components to create memoized components.   The result is a component that only rerenders when it's props change, acting kind of like shouldComponentUpdate(). Using m...
Web Tricks

How to implement multiple user authentications using Laravel Guards

Introduction As developers, there are couple of times where your application will require different type of users. Take for instance you're building a Hospital Management software and you need both Doctors and Patients to be entirely unique users. How do you handle registration and authentication for both users in such a scenario? Laravel makes it easy to authenticate against multiple user models by using guards and providers.   Guards and Providers Before we dive into building our app, let's understand the concepts behind Guards and Providers which are essentially the building blocks of implementing multiple user authentication in Laravel. What are Guards? Guards can be seen as a way of identifying authenticated users. Laravel ships with two default guards - weband apiwith pr...
Web Tricks

Use the React Profiler for Performance

With React, building high performance web applications became very easy because of the framework's re-rendering on the JavaScript virtual DOM, which helps it to quickly determine the changes needed when a user event is occurring. When writing complex application with React you will run into some performance issues, either because the application re-renders when it really doesn’t need to or because the states aren’t being handled properly, amongst other reasons.   What exactly is regarded a high performance application? Performance is really important when dealing with a complex application or any application. In fact if your application doesn't cover 60 frames per second (fps) which would give it like 16.7ms per frame, it is more than likely underperforming with regards to the st...
Web Tricks

React 16.6: React.memo() for Functional Components Rendering Control

React 16.6.0 is released! With it comes a host of new features including the two big ones: React.memo() React.lazy(): Code-splitting and lazy-loading with React Suspense We'll focus on React.memo() for this article and React.lazy() and Suspense in an upcoming larger article.   What is React.memo()? React.memo() is similar to PureComponent in that it will help us control when our components rerender. Components will only rerender if its props have changed! Normally all of our React components in our tree will go through a render when changes are made. With PureComponent and React.memo(), we can have only some components render. const ToTheMoonComponent = React.memo(function MyComponent(props) { // only renders if props have changed }); This is a performance bo...
Web Tricks

6 Reasons to Love Smaller CMS

  WordPress, Joomla, and Drupal; these are perhaps the three biggest names in the world of the consumer CMS. They are known, they are loved, they are behemoths for a good reason. There’s no escaping them. We are all WordPress, now. No, but seriously, there’s almost nothing they can’t do, with the judicious application of plugins, themes, and coding knowledge. Yeah, believe it or not, I’m not here to rag on them. Kudos to their developers. I’m just going to sit over here and show some love to the smaller CMS options for a bit. If I were given to fits of poetry, I might write a sonnet about them or something. Alas, Lord Byron I am not; I am not nearly so rich, I have no desire to invade Greece, I do not own a bear. Instead, you’ll be getting this article detailing some of t...
Web Tricks

Deploying Your First Gatsby Site to Netlify

Recently, Netlify has become one of the hotter topics in Web Development. They are loved in the community and just received millions of dollars of funding to continue making their product better. If you aren't familiar, Netlify is a web host with particular support Static Sites (think Gatsby.js, Next.js, etc.) as well as other incredible features like serverless (lambda) functions, free https certs, and more! In this article, we are going to walk through the steps to deploy a Gatsby app to Netlify. TLDR Create a Github Repository Create Gatsby App with Gatsby CLI Push App to Github Create New Site in Netlify and Connect to Github Repository Create GitHub Repository To deploy to Netlify, the easiest way is to set up Continuous Deployment by connecting to an existing r...
Web Tricks

Splicing HTML’s DNA With CSS Attribute Selectors

For most of my career, attribute selectors have been more magic than science. I’d stare, gobsmacked, at the CSS for outputting a link in a print style sheet, understanding nothing. I’d dutifully copy, and paste it into my print stylesheet then run off to put out whatever project was the largest burning trash heap. But you don’t have to stare slack-jawed at CSS attribute selectors anymore. By the end of this article, you’ll use them to run diagnostics on your site, fix otherwise unsolvable problems, and generate technologic experiences so advanced they feel like magic. You may think I’m promising too much and you’re right, but once you understand the power of attribute selectors, you might feel like exaggerating yourself. On the most basic level, you put an HTML attribute in square br...
Web Tricks

Data Enrichment with MongoDB Stitch

Objectives Here is what we are going to achieve in this tutorial: Firstly, we are going to write a document to MongoDB using MongoDB Stitch. The result in our MongoDB collection will look like this: { "_id": ObjectId("5bb27712dced5f37bebf388c"), "Title":"Guardians of the Galaxy" } Secondly, a trigger will catch this new insertion and start a function. Lastly, this function will call the OMDB external API with the given movie title, fetch data about that movie, and finally enrich our MongoDB document with the data we gathered from this API. This is the final result we expect in our MongoDB collection: { "_id": ObjectId("5bb27712dced5f37bebf388c"), "Title":"Guardians of the Galaxy", "Year":"2014", "Rated":"PG-13", "Released":"01 Aug 2014", ...
Web Tricks

Introducing GitHub Actions Part-2

The software development process from conception of the idea to writing of code and finally deploying the finished product can be quite tedious at times. You need to handle a variety of things beyond just writing the code. But what if you could take some of this work off your shoulders? Well, this is where Github Actions come in. A new feature recently introduced into Github, Github Actions allow you to automate your workflow by letting Github take care of a number of processes which can be triggered by a variety of events on the platform, be it pushing code, making a release or creating issues among others. What can you do with Github Actions? The possibilities are limitless, you could do anything from: handling continuous integration and deployment (building, testing and deployi...
Web Tricks

CSS Border-Radius Can Do That?

TL/DR: When you use eight values specifying border-radius in CSS, you can create organic looking shapes. During this year’s Frontend Conference Zurich Rachel Andrew talked about Unlocking the Power of CSS Grid Layout. At the end of her talk, she mentioned something about an old CSS property that got stuck in my head: The Image is set round just by using the well-supported border-radius. Don’t forget that old CSS still exists and is useful. You don’t need to use something fancy for every effect.  — Rachel Andrew Shortly after I heard this talk, I thought that you certainly could create more than just circles and started to dig deeper into what can be done using border-radius.   Mastering Border-Radius Single Value Let’s start with the basics. Hopefully this will not bore ...
Web Tricks

How to build a telegram bot using Node.js and Now

Introduction Serverless deployment, the intriguing topic grabbing a lot of attention from rookies and veterans alike in the tech ecosystem is finally here. In this article we'll be taking a practical approach to serverless deployment, also referred to as FaaS (Function as a Service). Serverless architecture, simply put is a way to build and run applications and services without managing server in infrastructure. Practical approach? We'll be building a telegram weather bot using node.js, which will be hosted on now. Requirements Registering a telegram bot using BotFather Yes! you guessed right. BotFather is also a bot. Before we go on to the nitty-gritty of coding our bot, we'll need to create and register the bot with BotFather in order to get an API key. We'll head over to BotFather...
Web Tricks

Photoshop Workflows And Shortcuts For Digital Artists

Adobe Photoshop plays a role in almost every digital creator’s life. Photoshop is what many digital artists, photographers, graphic designers, and even some web developers have in common. The tool is so flexible that often you can achieve the same results in several different ways. What sets us all apart is our personal workflows and our preferences on how we use it to achieve the desired outcome.I use Photoshop every day and shortcuts are a vital part of my workflow. They allow me to save time and to focus better on what I am doing: digital illustration. In this article, I am going to share the Photoshop shortcuts I use frequently — some of its features that help me be more productive, and a few key parts of my creative process.To profit the most from this tutorial, some familiarity with ...
All the News From Adobe MAX
Web Tricks

All the News From Adobe MAX

Adobe’s annual MAX conference is well underway in LA, and as usual there’s a big buzz around changes to the Creative Cloud suite. Adobe’s product line often seems archaic—parts of Photoshop’s first codebase were originally painted onto the walls of caves by neanderthals—but this iterative approach also provides a solid platform to venture into new ground in ways that would bankrupt a startup. Not only has Adobe pivoted into prototyping with XD, overtaking the existing market in a brief couple of years, but it’s now applying the same approach to new markets, where the competition is even thinner on the ground.   Adobe XD Updates Since May, when we reported that Adobe XD is now free, interest in the platform has grown exponentially. Despite interesting additions to Lightroom ...