Wednesday, April 12, 2017

This Week's HTML5, CSS and Browser Tech News #285

Read this e-mail on the Web
FrontEnd Focus
Issue 285 — April 12, 2017
A fantastic round-up of concepts, tools, and things to consider when doing one of a developer’s most important tasks: debugging.
Sarah Drasner

A major release for Edge that includes WebVR, CSS Custom Properties, Payment Request API, and experimental WebAssembly support. Test in the latest Edge using a VM image or for free on BrowserStack.
Microsoft

A practical guide on how to add accessibility information to HTML elements using the WAI-ARIA (Accessible Rich Internet Applications) spec.
W3C

Frontend Masters
A free, thorough and open source guide anyone could use to learn about the practice of front-end development.
Frontend Masters   Sponsor

Available as a Chrome Extension, command line app or Node module, Lighthouse is a Google-built tool for auditing Web pages for a variety of issues.
Google Developers

An attempt to shed some light on the invisible parts of CSS, such as the rendering process, the box model, and more.
Mike Riethmuller

Thoughts on why React has become so popular, so quickly, along with a demonstration of the core principles.
Samer Buna

Jobs Supported by Hired.com

Can't find the right job? Want companies to apply to you? Try Hired.com.

In Brief

Chrome Introducing 'Scroll Anchoring' to Eradicate Page Jumps news
Google

Creating Testable, Modularized Chrome Extensions tutorial
Nathaniel Woodthorpe

Case Study: My First Practical CSS Grid Layout tutorial
Tyler Sticka

CSS Grid Layout and PostCSS: Now 'KISS' tutorial
What happens when you combine a new powerful specification with a great processing tool?
Sylvain Pollet-Villard

Augmented Reality in 10 Lines of HTML (with AR.js and A-Frame) tutorial
Alexandra Etienne

Individualizing CSS Properties with CSS Variables tutorial
Dan Wilson

Block Formatting Contexts and Lists with 'display: flow-root' tutorial
Resolves the issue of weird padding/margins around floated elements.
Paul Bakaus

Building a CSS Grid Overlay tutorial
Andreas Larsen

Debugging CSS for UI Responsiveness tutorial
CSS properties and values that trigger reflows are costly when it comes to page and UI responsiveness.
Tiffany Brown

Encoding Data in CSS tutorial
How to encode color data in the CSS that can be read by scripts.
Alex Gyoshev

The Ultimate Guide to Hiring a Front-end Developer 
Our team has coded thousands of web and mobile projects. Learn how we hire the best front-end developers.
Code My Views  Sponsor

Automated Web Accessibility Testing with aXe video
A11ycasts

Creating Music with the Web Audio API video
A well produced 30 minute talk.
Rich Williams

Getting Started with Neat 2.0, A Lightweight and Flexible Sass Grid tutorial
Thoughtbot

Progressive Monitoring for Progressive Web Apps with SpeedTracker tools
A tool that allows you to monitor website performance over time.
Josh Habdas

Stylelint: A Modern CSS Linter With Over 150 Checks tools
.. and support for the latest CSS features.
Maxime Thirouin, David Clark, Richard Hallows

mq-scss: A Sass Mixin for Formulating Media Queries tools
Daniel Tonon

Try Bugsnag, and Get a Free T-Shirt 👕 tools
For a limited time, get a free shirt when you sign up and try Bugsnag for automatic JavaScript error monitoring.
Bugsnag  Sponsor

Embedo: A Modern Social Media Embed Plugin code
For Facebook, Twitter, Instagram, YouTube and Pinterest content.
Shobhit Sharma

SVG Icons for Popular Brands and Technologies code
Quite developer/tech focused and lots to choose from.
Simple Icons

Across Tabs: Easy Communication Between Cross Origin Browser Tabs code
Further info, documentation and a demo.
Wingify

Curated by Peter Cooper and Chris Brandrick and published by Cooperpress.
Like this? You may also enjoy: JavaScript Weekly, Node Weekly, and React Status.

Stop getting FrontEnd Focus : Change email address : Read this issue on the Web

© Cooper Press Ltd. Office 30, Lincoln Way, Louth, LN11 0LS, UK


by via FrontEnd Focus

2017 Design Trends

2017 Design Trends

Classic marketing Landing Page (with a duotone outer space theme) by Flywheel promoting their free ""2017 Design Trends" email course. The Single Page site is fittingly built on WordPress of course:)

by Rob Hope via One Page Love

Building a Python Code Review Scheduler: Keeping the Review Information

This Week in Mobile Web Development (#153)

Mobile Web Weekly April 12, 2017   #153
Holly Schinsky recommends
Ionic 3.0 Released: The Native and PWA App Framework — Ionic jumps to 3.0 in an Angular 4-style semantic versioning switch, bringing lazy loading, and Angular 4 and TypeScript 2.1+ compatibility.
The Official Ionic Blog
Peter Cooper recommends
How Twitter Built Twitter 'Lite' — A new progressive web app (PWA) available on mobile.twitter.com. Nicolas Gallagher explains the stack behind it.
Twitter Engineering
Chris Brandrick recommends
Twitter Lite and High Performance React PWAs at Scale — A look into removing performance bottlenecks, both common and uncommon, in one of the largest React.js PWAs, the aforementioned Twitter Lite.
Paul Armstrong
Sponsored
Linux cloud hosting starting at 1GB of RAM for $5/mo. — Get a Linode server up and running in seconds. Simply choose your plan, distro and location and you’re ready to deploy your server. Use promo code MOBILEWEB20 for a $20 credit on a new account.
linode

Brian Rinaldi recommends
Could Accelerated Mobile Pages Be Bad News for News? — Some well reasoned arguments as to why AMP may be bad for the web and publishers, despite good intentions.
Andrew Betts
Brian Rinaldi recommends
Combine AMP with Progressive Web Apps — A series of tutorials on how to enable PWA features in an AMP page, use an AMP page as an entry point into a PWA and use AMP as a data source for a PWA.
AMP Project
Holly Schinsky recommends
Cordova Android 6.2.1 Released — A new version of Cordova Android has been released and fixes issues with the Android SDK Tools as well as other important updates.
Apache Cordova
Brian Rinaldi recommends
The Importance of Mobile Web Performance in 2017 — A series of stats from a variety of sources related to web performance as well as AMP.
Pawel Piejko
Chris Brandrick recommends
Adding iOS Dynamic Type Support to Web Views — A how-to on getting iOS’s ‘Dynamic Type’ accessibility feature to play nice with CSS in your app’s web views.
Laura Kalbag
Brian Rinaldi recommends
No Share Buttons on Mobile Sites (Except This One Weird Case) — Josh Clark explains why you should not include social share buttons on mobile websites unless the user came from a social network.
Big Medium
Holly Schinsky recommends
Building an Ionic Image Gallery With Zoom — How to add an image gallery with zoom capabilities to your Ionic apps.
Simon Reimler
Holly Schinsky recommends
How to Create a PWA With Ionic That Scores 90+ on Google's Lighthouse
Dennis Bruijn
Holly Schinsky recommends
Ionic and Firebase Authentication — Learn how to authenticate users in your Ionic 3 apps with Firebase.
Aaron Czichon
Peter Cooper recommends
A Look at Ionic 3's New Lazy Loading Functionality
Paul Halliday
Holly Schinsky recommends
Add Serverless Firebase Push Notifications to Your React Native App — Part 2 in building a Chat App with React Native, showing how to add serverless push notifications with Firebase.
Shoutem
Chris Brandrick recommends
How To Set Up An Automated Testing System Using Android Phones — A case study written by Mail.Ru’s test engineer on how to build a flexible and extensible automated testing system for Android smartphones — from scratch.
Alexey Perfilov
Holly Schinsky recommends
Debugging CSS for UI Responsiveness — CSS properties and values that trigger reflows are costly when it comes to page and UI responsiveness.
Tiffany Brown
Holly Schinsky recommends
Automatic Icon Export for HTML, iOS, and Android — How to use Sketch to export your app assets in multiple resolutions and formats.
William Candillon
Holly Schinsky recommends
PWA with Ionic Framework: Frequently Asked Questions — FAQ on building Progressive Web Apps with Ionic.
Jorge Vergara
Brian Rinaldi recommends
Creating Your First Native Mobile App with Visual Studio — Part 2 in this series on building a native mobile app in Visual Studio with NativeScript focuses on creating the layout and connecting dummy data.
Rob Lauer
Holly Schinsky recommends
phonegap-visuals-generator: Generate Visuals for PhoneGap — Icon and Splash Screens generator for Cordova/PhoneGap apps.
Adrian Voica


by via Mobile Web Weekly

List Comprehensions in Python

List comprehensions provide you a way of writing for loops more concisely. They can be useful when you want to create new lists from existing lists or iterables. For example, you can use list comprehensions to create a list of squares from a list of numbers. Similarly, you could also use some conditions on a list of numbers so that the new list you create is a subset of the original list. 

Keep in mind that you cannot write every for loop as a list comprehension. One more thing: the name "list comprehensions" can be a bit confusing because it seems to suggest that the comprehensions are only meant for working with lists. In reality, the word "list" in list comprehensions is used to indicate that you can loop over any iterable in Python and the end product would be a list. 

Loops and List Comprehensions

Basic list comprehensions that don't use any conditions have the following form:

Let's begin by writing a very basic for loop to list the first 15 multiples of 5. First, you need to create an empty list. Then, you have to iterate over a range of numbers and multiply them by 5. The new sequence of numbers that you get will consist of multiples of 5. 

The above for loop basically has the following structure: 

If you compare it with the list comprehension form that you read earlier, you can see that <the_element> is n, <the_iterable> is range(1,16), and <the_expression> is n*5. Putting these values in the list comprehension will give us the following result:

Similarly, you can also get a list with the cube of given numbers like this:

Conditions in List Comprehensions

You can also use an if condition to filter out certain values from the final list. In this case, the list comprehension takes the following form:

A basic example of this type of comprehension would be to get all the even numbers in a given range. A for loop to do this task will look like this:

The same thing could also be accomplished by using the following list comprehension:

A more complex example of using list comprehensions would be adding .. if .. else .. conditional expressions inside them. 

In this case, the order in which you lay out the statements inside the list comprehension will be different from usual if conditions. When you only have an if condition, the condition goes to the end of the comprehension. However, in the case of an .. if .. else .. expression, the positions of the for loop and the conditional expression are interchanged. The new order is:

Let's begin by writing the verbose .. if .. else .. conditional expression to get squares of even numbers and cubes of odd numbers in a given range.

The above conditional expression has the following structure:

Putting the corresponding values in the right places will give you the following list comprehension:

List Comprehensions for Nested Loops

You can also use nested loops within a list comprehension. There is no limit on the number of for loops that you can put inside a list comprehension. However, you have to keep in mind that the order of the loops should be the same in both the original code and the list comprehension. You can also add an optional if condition after each for loop.  A list comprehension with nested for loops will have the following structure:

The following examples should make everything clearer. There are two nested loops, and multiplying them together gives us multiplication tables.

These nested for loops can be rewritten as:

Once you have written the loop in this form, converting it to a list comprehension is easy:

You can also use a similarly written list comprehension to flatten a list of lists. The outer for loop iterates through individual lists and stores them in the variable row. The inner for loop will then iterate through all the elements in the current row. During the first iteration, the variable row has the value [1, 2, 3, 4]. The second loop iterates through this list or row and appends all those values to the final list.

Nested List Comprehensions

Nested list comprehensions may sound similar to list comprehensions with nested loops, but they are very different. In the first case, you were dealing with loops within loops. In this case, you will be dealing with list comprehensions within list comprehensions. A good example of using nested list comprehensions would be creating a transpose of the matrix for the previous section.

Without a list comprehension expression, you will need to use two for loops to create the transpose.

The outer loop iterates through the matrix four times because there are four columns in it. The inner loop iterates through the elements inside the current row one index at a time and appends it to a temporary list called temp. The temp list is then appended as a row to the transposed matrix. In the case of nested list comprehensions, the outermost loop comes at the end and the innermost loop comes at the beginning. 

Here is the above code in the form of a list comprehension:

Another way to look at this is by considering the structure of list comprehensions that replace the basic for loops that you learned about at the beginning of the article.

If you compare it with the nested list comprehension above, you will see that <the_expression> in this case is actually another list comprehension: [row[n] for row in matrix]. This nested list comprehension itself is in the form of a basic for loop.

Final Thoughts

I hope this tutorial helped you understand what list comprehensions are and how to use them in place of basic for loops to write concise and slightly faster code while creating lists. 

Another thing that you should keep in mind is the readability of your code. Creating list comprehensions for nested loops will probably make the code less readable. In such cases, you can break down the list comprehension into multiple lines to improve readability.

Additionally, don’t hesitate to see what we have available for sale and for study on Envato Market, and don't hesitate to ask any questions and provide your valuable feedback using the feed below.


by Monty Shokeen via Envato Tuts+ Code

Ivan Aivazovsky

A non-commercial site dedicated to the 200ᵀᴴ anniversary of Ivan Aivazovsky, a world-famous Russian marine painter
by via Awwwards - Sites of the day

The “Most Loved” One Page Websites from March 2017

March’s “Most Loved” One Page website round-up is brought to you by hosting provider, Bluehost.

one-page-love-hosting-reviews-bh-unlimited

Bluehost is the most affordable hosting option to host your One Page websites. They have an incredible $2.95/month deal exclusive to One Page Readers where you can host your website with 50GB diskspace and unlimited bandwidth. They also throw in a free domain!

If you want to get notified about the “Most Loved” awards each month, subscribe to our Inspiration Newsletter.

Below are the 5 One Page websites awarded “Most Loved” in March – hope you enjoy!


Nike – 15 Years of SB Dunk (Competition, Long-Form Journalism)

Brilliant One Pager by Nike celebrating 15 Years of their SB Dunks. The campaign Landing Page is visually stunning including hover sensitive parallax effects, slick load transitions and beautiful big imagery of the products.


Holbein (Competition, Long-Form Journalism)

Unique multi-scrolling and zooming One Pager for London-based financial advisers, Holbein. The Single Page site features a big, colorful background image/canvas with the content arranged in neat blocks. The design really fills a big screen well and adapts gracefully to mobile.


Perspective (Competition, Long-Form Journalism)

Slick One Pager announcing Perspective, a new machine learning API project by the Google Jigsaw team. The Single Page site features a gorgeous interactive slider demonstrating exactly how the API filters and moderates content. Further down is another interactive blank document that rates your inputted text in real time. Interactive content, as shown here, really is the future of of Landing Page design.


Zest (Competition, Long-Form Journalism)

Beautiful landing page for Zest – a Chrome Extension that fills your new tabs with quality curated marketing content. The colorful One Pager features fancy hover-sensitive parallax effects that even integrates with the gyro on your mobile. There are loads more lovely touches and slick transitions throughout the page, my favorite being the light effect on the moon.


Inbox of Forgotten Emails (Competition, Long-Form Journalism)

‘Inbox of Forgotten Emails’ is a hilarious One Pager collecting funny or embarrassing emails we didn’t have the guts to send. The UI is naturally similar to an email inbox, with an AJAX loading category filter and a smart compose email (submission) form. Neat touch with the color scheme switcher too. Cheers CreativeMornings and MailChimp for this awesome collaboration ☕️ 🍌


ComicKult (Competition, Long-Form Journalism)

Incredibly slick launching soon page for ‘ComicKult’ – an upcoming portal for the comic community. The unique One Pager features an impressive comic book cover “tiled waterfall” background. There is so much attention to detail from cover Retina optimization to sign up form button animations. Make sure once signed up to enter in the Konami Code, sit back and be blown away. What an incredible first impression I’m sure the comic community is going to be drooling about. Cheers for the awesome build notes!

Read my interview with the ComicKult team.


Hope you enjoyed these beautiful One Pagers from March! Big love to hosting provider Bluehost for sponsoring the round up:)


by Rob Hope via One Page Love