| import { CloudFront } from "aws-sdk"; | |
| import * as url from "url"; | |
| import { CreateDistributionWithTagsResult, GetDistributionResult, UpdateDistributionResult } from "aws-sdk/clients/cloudfront"; | |
| export class CloudFrontClient { | |
| private cloudFront: CloudFront; | |
| constructor() { | |
| this.cloudFront = new CloudFront({ | 
| /** | |
| * This code is based on Nader Dabit's tutorial for custom Cognito authentication | |
| * using AWS Amplify and React: https://www.youtube.com/watch?v=JaVu-sS3ixg&t=24s | |
| * | |
| * It's 99% the same as the video, but I've sprinkled a few niceties here and there. | |
| */ | |
| import React, { useEffect, useState } from "react"; | |
| import Amplify, { Auth, Hub } from "aws-amplify"; | 
Original guide with a standard build is here.
With this guide, I'm adding more instructions to enable support for NVIDIA CUVID and NVIDIA NPP for enhanced encode and decode performance.
First, prepare for the build and create the work space directory:
cd ~/
| // we have an array of objects, we want to remove one object using only the id property | |
| const apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}]; | |
| // get index of object with id of 37 | |
| const removeIndex = apps.findIndex( item => item.id === 37 ); | |
| // remove object | |
| apps.splice( removeIndex, 1 ); | |
https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff
While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.
JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu
Recommendations of unit types per media type:
| Media | Recommended | Occasional use | Infrequent use | Not recommended | 
|---|---|---|---|---|
| Screen | em, rem, % | px | ch, ex, vw, vh, vmin, vmax | cm, mm, in, pt, pc | 
| em, rem, % | cm, mm, in, pt, pc | ch, ex | px, vw, vh, vmin, vmax | 
