Friday, April 13, 2018

Pinterest To Let You Add Cover Images Very Soon

To stay relevant and competitive, social platforms make necessary changes every now and then. Subsequently, Pinterest has decided to introduce the addition of cover images and it is currently working on this very feature. A collage will be made of your Pins for the cover image. The change was...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Zubair Ahmed via Digital Information World

Writing your own promise library, and what's new in Angular 6?

#381 — April 13, 2018

Read on the Web

JavaScript Weekly

The Front-End Developer Handbook 2018 Edition — An online guide that outlines and discusses the practice of front-end engineering, how to learn it and what tools are used in the practice, as of 2018.

Cody Lindley

Write Your Own Promise Library from Scratch — Async/await is based on promises, so understanding this popular async primitive is a must.

Valeri Karpov

Understanding TypeScript’s Type Notation — Dr. Axel presents a handy guide to the static type notation used in TypeScript, the optionally typed JavaScript superset, and promises you’ll understand an initially cryptic code example by the end of his post.

Dr. Axel Rauschmayer

Improve the Quality of Your JavaScript Projects with Codacy — An automated code review tool that allows developers to improve code quality. We check your code against the most popular JS static analysis tools, with specific plugins for Vue, Angular and React. Sign up for free and improve your coding.

Codacy sponsor

Optimizing React: The Virtual DOM Explained — A beginner-friendly intro to React’s internals that attempts to demystify JSX and explain how React makes rendering decisions.

Alexey Ivanov and Andy Barnov

How to Escape async/await 'Hell' — Take care you don’t escape from ‘callback hell’ only to fall into bad practices using async/await instead.

Aditya Agarwal

Why React Needs Yet Another Animation Libraryreact-spring is a set of physics-based UI animation ‘building blocks’. GitHub repo.

Paul Henschel

Demo: Object Detection in the Browser with TensorFlow.js — Take care as a 40MB machine learning model gets downloaded, but this is a neat browser-based demo of TensorFlow.js that leans on YOLO for object recognition.

ModelDepot

What's New in Angular 6?Angular 6 RC4 is out with the final Angular 6 due any moment, but what’s new?

Phani Kiran G

AngularConnect 2018 - Europe’s Largest Angular Conference — Join us to hear from 40+ speakers including the core Angular team. Our CFP is open & tickets available now.

AngularConnect sponsor

📖 Articles and Tutorials

Abusing Proxies for DSLs — Be sure to read the disclaimer, but it’s interesting stuff to think about.

Mike Cluck

List Processing with map, filter, and reduce

Peleke Sengstacke

A Practical Guide to Angular Elements

Nitay Neeman

Learn JavaScript Free for 10 Days — Writing front-end code? In need of back-end server skills? Start a 10-day trial to sharpen your dev skills.

Pluralsight sponsor

How to Build a Server-Side Rendered App with Preact, Unistore and Preact Router — Preact is a lighter alternative to React but with the same API.

Yomi Eluwande

Using Async Iteration Natively in Node — How async iteration over streams will work in Node 10.x.

Dr. Axel Rauschmayer

▶  Vue in Motion — A 35 minute talk on using UI animation in Vue apps.

Rachel Nabors

Jobs

UX/UI Designers - Milan, Italy — MotorK is looking for passionate Junior and Senior UX/UI Designers to join the team. Great place to work and career opportunities.

MotorK

Senior Front-End Engineer, React/Redux — At Manifold, we’re creating the world’s largest independent cloud marketplace. Made by developers who care, for developers who care.

Manifold

No Search, No Spam, No Hassle — SW Engineers in NY & SF: Get opportunities personalized to you. Discreetly create a profile on Woo.io today.

Woo.io

🔧 Code and Tools

Redux 4.0.0-rc1 Released — The final 4.0 is due next week but you can experiment now.

Tim Dorr

The Microsoft JavaScript API Browser — Bill itself as your ‘one-stop shop’ for all of Microsoft’s JavaScript-based APIs (e.g. for Azure and SharePoint).

Microsoft

Cytoscape.js: Graph/Network Visualization and Analysis Library

Cytoscape Consortium

shallow-render: Angular 5 Testing Made Easy with Shallow Rendering and Easy Mocking

Brandon Domingue

Build a Simple Shopping Cart based on MongoDB, Express, Angular, and Node

mongodb sponsor

JavaScript State Machine: A Finite State Machine Library

Jake Gordon

virtual-audio-graph: Declaratively Manipulate the Web Audio API — The documentation and examples here may help you understand this.

Benji Hall

🐦 Seen on Twitter


by via JavaScript Weekly

Jacqui Nguyen

Unique stacked-accordion of projects in this One Page portfolio for architect Jacqui Nguyen.

Full Review | Direct Link


by Rob Hope @robhope via One Page Love

ES6 Generators and Iterators: a Developer’s Guide

ES6 brought a number of new features to the JavaScript language. Two of these features, generators and iterators, have substantially changed how we write specific functions in more complex front-end code.

While they do play nicely with each other, what they actually do can be a little confusing, so let’s check them out.

Iterators

Iteration is a common practice in programming and is usually used to loop over a set of values, either transforming each value, or using or saving it in some way for later.

In JavaScript, we’ve always had for loops that look like this:

for (var i = 0; i < foo.length; i++){
  // do something with i
}

But ES6 gives us an alternative:

for (const i of foo) {
  // do something with i
}

This is arguably way cleaner and easier to work with, and reminds me of languages like Python and Ruby. But there’s something else that’s pretty important to note about this new kind of iteration: it allows you to interact with elements of a data set directly.

Imagine that we want to find out if each number in an array is prime or not. We could do this by coming up with a function that does exactly that. It might look like this:

function isPrime(number) {
  if (number < 2) {
    return false;
  } else if (number === 2) {
    return true;
  }

  for (var i = 2; i < number; i++) {
    if (number % i === 0) {
      return false;
      break;
    }
  }

  return true;
}

Not the best in the world, but it works. The next step would be to loop over our list of numbers and check whether each one is prime with our shiny new function. It’s pretty straightforward:

var possiblePrimes = [73, 6, 90, 19, 15];
var confirmedPrimes = [];

for (var i = 0; i < possiblePrimes.length; i++) {
  if (isPrime(possiblePrimes[i])) {
    confirmedPrimes.push(possiblePrimes[i]);
  }
}

// confirmedPrimes is now [73, 19]

Again, it works, but it’s clunky and that clunkiness is largely down to the way JavaScript handles for loops. With ES6, though, we’re given an almost Pythonic option in the new iterator. So the previous for loop could be written like this:

const possiblePrimes = [73, 6, 90, 19, 15];
const confirmedPrimes = [];

for (const i of possiblePrimes){
   if ( isPrime(i) ){
      confirmedPrimes.push(i);
   }
}

// confirmedPrimes is now [73, 19]

This is far cleaner, but the most striking bit of this is the for loop. The variable i now represents the actual item in the array called possiblePrimes. So, we don’t have to call it by index anymore. This means that instead of calling possiblePrimes[i] in the loop, we can just call i.

Behind the scenes, this kind of iteration is making use of ES6’s bright and shiny Symbol.iterator() method. This bad boy is in charge of describing the iteration and, when called, returns a JavaScript object containing the next value in the loop and a done key that is either true or false depending on whether or not the loop is finished.

In case you’re interested in this sort of detail, you can read more about it on this fantastic blog post titled Iterators gonna iterate by Jake Archibald. It’ll also give you a good idea of what’s going on under the hood when we dive into the other side of this article: generators.

Continue reading %ES6 Generators and Iterators: a Developer’s Guide%


by Byron Houwens via SitePoint

ES6 in Action: Destructuring Assignment

Destructuring assignment sounds complex. It reminds me of object-oriented terms such as encapsulation and polymorphism. I’m convinced they were chosen to make simple concepts appear more sophisticated!

In essence, ECMAScript 6 (ES2015) destructuring assignment allows you to extract individual items from arrays or objects and place them into variables using a shorthand syntax. Those coming from PHP may have encountered the list() function, which extracts arrays into variables in one operation. ES6 takes it to another level.

Presume we have an array:

const myArray = ['a', 'b', 'c'];

We can extract these values by index in ES5:

var
  one   = myArray[0],
  two   = myArray[1],
  three = myArray[2];

// one = 'a', two = 'b', three = 'c'

ES6 destructuring permits a simpler and less error-prone alternative:

const [one, two, three] = myArray;

// one = 'a', two = 'b', three = 'c'

You can ignore certain values, e.g.

const [one, , three] = myArray;

// one = 'a', three = 'c'

or use the rest operator (...) to extract remaining elements:

const [one, ...two] = myArray;

// one = 'a', two = ['b, 'c']

Destructuring also works on objects, e.g.

var myObject = {
  one:   'a',
  two:   'b',
  three: 'c'
};

// ES5 example
var
  one   = myObject.one,
  two   = myObject.two,
  three = myObject.three;

// one = 'a', two = 'b', three = 'c'

// ES6 destructuring example
const {one, two, three} = myObject;

// one = 'a', two = 'b', three = 'c'

In this example, the variable names one, two and three matched the object property names. We can also assign properties to variables with any name, e.g.

const myObject = {
  one:   'a',
  two:   'b',
  three: 'c'
};

// ES6 destructuring example
const {one: first, two: second, three: third} = myObject;

// first = 'a', second = 'b', third = 'c'

More complex nested objects can also be referenced, e.g.

const meta = {
  title: 'Destructuring Assignment',
  authors: [
    {
      firstname: 'Craig',
      lastname: 'Buckler'
    }
  ],
  publisher: {
    name: 'SitePoint',
    url: 'http://www.sitepoint.com/'
  }
};

var {
    title: doc,
    authors: [{ firstname: name }],
    publisher: { url: web }
  } = meta;

/*
  doc   = 'Destructuring Assignment'
  name  = 'Craig'
  web   = 'http://www.sitepoint.com/'
*/

This appears a little complicated but remember that in all destructuring assignments:

  • the left-hand side of the assignment is the destructuring target — the pattern which defines the variables being assigned
  • the right-hand side of the assignment is the destructuring source — the array or object which holds the data being extracted.

There are a number of other caveats. First, you can’t start a statement with a curly brace, because it looks like a code block, e.g.

// THIS FAILS
{ a, b, c } = myObject;

You must either declare the variables, e.g.

// THIS WORKS
const { a, b, c } = myObject;

or use parentheses if variables are already declared, e.g.

// THIS WORKS
({ a, b, c } = myObject);

You should also be wary of mixing declared and undeclared variables, e.g.

// THIS FAILS
let a;
let { a, b, c } = myObject;

// THIS WORKS
let a, b, c;
({ a, b, c } = myObject);

That’s the basics of destructuring. So when would it be useful? I’m glad you asked …

Continue reading %ES6 in Action: Destructuring Assignment%


by Craig Buckler via SitePoint

Pressure.js : JavaScript library for handling Force Touch & 3D Touch

Pressure is a JavaScript library for handling both Force Touch and 3D Touch on the web, bundled under one library with a simple API that makes working with them painless.

The post Pressure.js : JavaScript library for handling Force Touch & 3D Touch appeared first on Best jQuery.


by Admin via Best jQuery

Gmail To Get A Makeover In The Coming Weeks

Google is currently testing on the new Gmail design which is due to be rolled out in the coming weeks. The tech giant revealed its plans yesterday of launching new Gmail design for the web users which will be inclusive of some refined features of Google’s Material Design. Moreover, there will be...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Zubair Ahmed via Digital Information World