Saturday, June 16, 2018

Myfood

Pioneer of Smart Greenhouses. Produce your own food at home on your garden, rooftop or balcony. Eat ultra-fresh vegetables without any pesticides all over the year.
by via Awwwards - Sites of the day

Facebook Advertising Updates

Welcome to this week’s edition of the Social Media Marketing Talk Show, a news show for marketers who want to stay on the leading edge of social media. On this week’s Social Media Marketing Talk Show, we explore Instagram shoppable tags in Stories with Jeff Sieh, Facebook ads updates, Twitter news features with Madalyn Sklar, [...]

The post Facebook Advertising Updates appeared first on .


by Grace Duffy via

Friday, June 15, 2018

7 Performance Tips for Jank-free JavaScript Animations

The role of web animation has evolved from mere decorative fluff to serving concrete purposes in the context of user experience --- such as providing visual feedback as users interact with your app, directing users' attention to fulfill your app's goals, offering visual cues that help users make sense of your app's interface, and so on.

To ensure web animation is up to such crucial tasks, it's important that motion takes place at the right time in a fluid and smooth fashion, so that users perceive it as aiding them, rather than as getting in the way of whatever action they're trying to pursue on your app.

One dreaded effect of ill-conceived animation is jank, which is explained on jankfree.org like this:

Modern browsers try to refresh the content on screen in sync with a device's refresh rate. For most devices today, the screen will refresh 60 times a second, or 60Hz. If there is some motion on screen (such as scrolling, transitions, or animations) a browser should create 60 frames per second to match the refresh rate. Jank is any stuttering, juddering or just plain halting that users see when a site or app isn't keeping up with the refresh rate.

If animations are janky, users will eventually interact less and less with your app, thereby negatively impacting on its success. Obviously, nobody wants that.

In this article, I've gathered a few performance tips to help you solve issues with JavaScript animations and make it easier to meet the 60fps (frame per second) target for achieving smooth motion on the web.

#1 Avoid Animating Expensive CSS Properties

Whether you plan on animating CSS properties using CSS Transitions/CSS keyframes or JavaScript, it's important to know which properties bring about a change in the geometry of the page (layout) --- meaning that the position of other elements on the page will have to be recalculated, or that painting operations will be involved. Both layout and painting tasks are very expensive for browsers to process, especially if you have several elements on your page. As a consequence, you'll see animation performance improve significantly if you avoid animating CSS properties that trigger layout or paint operations and stick to properties like transforms and opacity, because modern browsers do an excellent job of optimizing them.

On CSS Triggers you'll find an up-to-date list of CSS properties with information about the work they trigger in each modern browser, both on the first change and on subsequent changes.

CSS Triggers Website

Changing CSS properties that only trigger composite operations is both an easy and effective step you can take to optimize your web animations for performance.

#2 Promote Elements You Want to Animate to Their Own Layer (with Caution)

If the element you want to animate is on its own compositor layer, some modern browsers leverage hardware acceleration by offloading the work to the GPU. If used judiciously, this move can have a positive effect on the performance of your animations.

To have the element on its own layer, you need to promote it. One way you can do so is by using the CSS will-change property. This property allows developers to warn the browser about some changes they want to make on an element, so that the browser can make the required optimizations ahead of time.

However, it's not advised that you promote too many elements on their own layer or that you do so with exaggeration. In fact, every layer the browser creates requires memory and management, which can be expensive.

You can learn the details of how to use will-change, its benefits and downsides, in An Introduction to the CSS will-change Property by Nick Salloum.

#3 Replace setTimeOut/setInterval with requestAnimationFrame

JavaScript animations have commonly been coded using either setInterval() or setTimeout().

The code would look something like this:

var timer;
function animateElement() {
  timer = setInterval( function() {
    // animation code goes here
  } , 2000 );
}

// To stop the animation, use clearInterval
function stopAnimation() {
  clearInterval(timer);
}

Although this works, the risk of jank is high, because the callback function runs at some point in the frame, perhaps at the very end, which can result in one or more frames being missed. Today, you can use a native JavaScript method which is tailored for smooth web animation (DOM animation, canvas, etc.), called requestAnimationFrame().

requestAnimationFrame() executes your animation code at the most appropriate time for the browser, usually at the beginning of the frame.

Your code could look something like this:

function makeChange( time ) {
  // Animation logic here

  // Call requestAnimationFrame recursively inside the callback function
  requestAnimationFrame( makeChange ):
}

// Call requestAnimationFrame again outside the callback function
requestAnimationFrame( makeChange );

Performance with requestAnimationFrame by Tim Evko here on SitePoint offers a great video introduction to coding with requestAnimationFrame().

The post 7 Performance Tips for Jank-free JavaScript Animations appeared first on SitePoint.


by Maria Antonietta Perna via SitePoint

Office 365 being rewritten in JavaScript

#390 — June 15, 2018

Read on the Web

JavaScript Weekly

JavaScript Engine Fundamentals — A fantastic writeup (with video, if preferred) looking at the key parts of major JavaScript VMs/engines and how they interact with the code you write.

Mathias Bynens

Polly.js: Record, Replay, and Stub HTTP Interactions — A library from Netflix for recording, replaying and stubbing HTTP interactions via native browser APIs. GitHub repo.

Netflix

💻 New Course: A Practical Guide to Algorithms with JavaScript — Bored by the academic approach of most data structures and algorithms courses? This is for you. Solve algorithms and analyze space and time complexity in both an interview setting and in your day-to-day development.

Frontend Masters sponsor

Office 365 Is Being Rewritten in JavaScript — Joining Skype, Microsoft Teams, and VS Code. React Native Windows is the approach used, making it possible to build seamless Windows 10 and Xbox One apps with React.

Sean Thomas Larkin on Twitter

Vue Native: Build Native Mobile Apps with Vue.js — React has React Native, and now if you’re a Vue.js developer, you could give this a try. Unlike React Native this isn’t an official project from the same team and is essentially a Vue wrapper around React Native itself. Introductory article.

GeekyAnts

How V8's Concurrent Marking Frees Up The Main Thread — ‘Marking’ is a key step in V8 6.4’s garbage collection process and now this process takes place on separate worker threads meaning more time for your code on Chrome 64+ and Node 10+.

Mathias Bynens

Introducing 'The GraphQL Guide' — John Resig, the creator of jQuery, has co-written a book aiming to show you why GraphQL APIs are “the true successor to REST APIs”.

John Resig and Loren Sands-Ramshaw

Vue.js Passes React in Terms of GitHub Star Count — A vanity metric for sure, but an interesting one nonetheless. React still has significantly more downloads each day but Vue’s community is particularly vibrant and eager.

Dan Abramov on Twitter

The Biggest Lead Developer Conference Yet Is Coming to London in 2 Weeks

The Lead Developer London sponsor

💻 Jobs

React/Full-Stack Engineer (Remote) — Join our small, distributed team as we build the world’s largest open library of freely usable visuals. Open to all, regardless of experience and background.

Unsplash

Have You Tried Vettery? — Vettery matches top tech talent with fast-growing companies. Take a few minutes to join our platform.

Vettery

📘 Tutorials

Understanding the Almighty Reducer — A beginner-friendly walkthrough of using JavaScript’s reduce method.

Sarah Drasner

What's New in ES2018 — Including async iteration, Promise.finally(), and rest/spread properties.

Craig Buckler

▶  Look, No Hands! — Brain Controlled JavaScript — Fun with thought processed interactions using a brain sensor with JavaScript.

Charlie Gerard

▶  Learn to Build a Slack Integration — A demo of Slack’s new developer features, with an introduction to Actions, showing what it enables for developers, and some possible use cases.

Slack sponsor

Submitting HTML Forms using Vue, React, or Hyperapp

Ogundipe Samuel

An Introduction to Sails.js — A Rails-esque MVC framework for Node webapps.

Ahmed Bouchefra

▶  How to Set Up A Windows Dev Environment That Feels Like $HOME — This isn’t JS specific but we’re always hearing of developers trying out Windows lately so this could be helpful.

Sarah Cooley and Tara Raj

▶  How to Code Your Own Discord Bot with Discord.js

Dapper Dino

🔧 Code and Tools

Parcel 1.9 Released with Tree Shaking and 2x Faster Watcher — If you want a fast, easy, zero-config bundler.

Devon Govett

A Much Faster Way to Debug Code Than with Breakpoints or Console.log — Wallaby catches errors in your tests and displays the results of expressions right in your editor as you type.

Wallaby.js sponsor

Licensed: A CLI for Adding a LICENSE File to Your Projects

Mihir Chaturvedi

collect.js: 91 Convenience Methods for Arrays and Objects — A similar API to Laravel Collections: chunk, flatten, shuffle, firstWhere, etc.

Daniel Eckermann

Pickr: A Flat, Simple, Dependency-Free Color PickerLive demo. It’s nice.

Simon Wep

Math.js: An Extensive Math Library for JavaScript and Node — There’s a CoffeeScript-oriented intro too, if that’s your bag.

Jos de Jong

jeelizWeboji: Realtime JS Face Tracking and Facial Expression Detection

Bourry Xavier

HyperMD: A WYSIWYG Markdown Editor for Browsers — Written in TypeScript. Demo here.

Lv Yang

Vuesax: A Frontend Vue.js Components Framework

Lusaxweb


by via JavaScript Weekly

How to Run a Successful Ecommerce Store with No Staff

Small businesses are the backbone of the economy. In fact, there about 28 million small businesses in the United States alone. These companies are extremely diverse, and provide a wide variety of goods to consumers. Part of the American spirit is tied up in being a small business owner....

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

by Web Desk via Digital Information World

Getting Started With the Fabric Python Library

Fabric is a Python library and command-line tool for streamlining the use of SSH for application deployment or systems administration tasks. Fabric is very simple and powerful and can help to automate repetitive command-line tasks. This approach can save time by automating your entire workflow. 

This tutorial will cover how to use Fabric to integrate with SSH and automate tasks.

Installation

Fabric is best installed via pip:

Getting Started With Fabric

Usage

Below is a simple function demonstrating how to use Fabric.

The program above is then saved as fabfile.py in your current working directory. The welcome function can be executed with the fab tool as follows:

Fabric provides the fab command which reads its configuration from a file, fabfile.py. The file should be in the directory from which the command is run. A standard fabfile contains the functions to be executed on a remote host or a group of remote hosts.

Features

Fabric implements functions which can be used to communicate with remote hosts:

fabric.operations.run()

This operation is used to run a shell command on a remote host.

Examples

fabric.operations.get()

This function is used to download file(s) from a remote host. The example below shows how to download a backup from a remote server.

fabric.operations.put()

This functions uploads file(s) to a remote host. For example:

fabric.operations.reboot()

As the name suggests, this function reboots a system server.

fabric.operations.sudo()

This function is used to execute commands on a remote host with superuser privileges. Additionally, you can also pass an additional user argument which allows you to run commands as another user other than root.

Example

fabric.operations.local()

This function is used to run a command on the local system. An example is:

fabric.operations.prompt()

The function prompts the user with text and returns the input.

Examples

fabric.operations.require()

This function is used to check for given keys in a shared environment dict. If not found, the operation is aborted.

SSH Integration

One of the ways developers interact with remote servers besides FTP clients is through SSH. SSH is used to connect to remote servers and do everything from basic configuration to running Git or initiating a web server.

With Fabric, you can perform SSH activities from your local computer.

The example below defines functions that show how to check free disk space and host type. It also defines which host will run the command:

In order to run this code, you will need to run the following command on the terminal:

Output

Automating Tasks

Fabric enables you to run commands on a remote server without needing to log in to the remote server.

Remote execution with Fabric can lead to security threats since it requires an open SSH port, especially on Linux machines.

For instance, let's assume you want to update the system libraries on your remote server. You don't necessarily need to execute the tasks every other time. You can just write a simple fab file which you will run every time you want to execute the tasks.

In this case, you will first import the Fabric API's module:

Define the remote host you want to update:

Set the username of the remote host:

Although it's not recommended, you might need to specify the password to the remote host.

Lastly, define the function that updates the libraries in your remote host.

Now that your fab file is ready, all you need to do is execute it as follows:

You should see the following result:

If you didn't define the password, you will be prompted for it.

After the program has finished executing the defined commands, you will get the following response, if no errors occur:

Conclusion

This tutorial has covered what is necessary to get started with Fabric locally and on remote hosts. You can now confidently start writing your own scripts for building, monitoring or maintaining remote servers.


by Esther Vaati via Envato Tuts+ Code

Bootstrap Strength Meter with jQuery

Bootstrap Strength Meter is a simple password strength meter based on Password Score.

The post Bootstrap Strength Meter with jQuery appeared first on Best jQuery.


by Admin via Best jQuery