Wednesday, October 12, 2016

Master Authentication With Laravel in Our New Short Course

AtoZ CSS Quick Tip: Control Element Visibility with Opacity

O is for opacity

We can use opacity to control the visibility of elements on the page - anything from completely transparent to completely opaque as discussed in the original screencast video.

Here’s a couple of tips when using opacity to ensure the right parts of the element are semi-transparent and to demonstrate how we can create fading effects without relying on JavaScript effects libraries.

Tip 1: opacity applies to the whole element

When setting opacity on an element, the whole element, including its children are made semi-transparent. The opacity is not inherited by the children so unfortunately you can’t set opacity:1 on them to make them fully opaque again.

If you want to have the background of an element semi-transparent but want the child elements (eg: text or images) to be opaque, use a semi-transparent background instead of using opacity.

[code language="css"]
.module {
background: rgba(255,255,255,0.5); /* semi-trans white */
}
[/code]

Tip 2: opacity affects stacking context

When setting opactiy to a value less than 1 the element is placed on a new layer so the background can be shown beneath the semi-transparent element. This is similar to how z-index works and, just like z-index, using opacity creates a new stacking context.

Continue reading %AtoZ CSS Quick Tip: Control Element Visibility with Opacity%


by Guy Routledge via SitePoint

Building RESTful APIs With Flask: An ORM With SQLAlchemy

In the first part of this three-part tutorial series, we saw how to write RESTful APIs all by ourselves using Flask as the web framework. The previous approach provided a whole lot of flexibility but also included writing a lot of code that otherwise could have been avoided in more generic cases. 

In this part, we will use a Flask extension, Flask-Restless, which simply generates RESTful APIs for database models defined with SQLAlchemy. I will take the same sample application as in the last part of this series to maintain context and continuity.

Installing Dependencies

While continuing with the application from the first part, we need to install only one dependency:

The Application

Flask-Restless makes adding RESTful API interfaces to models written with SQLAlchemy a piece of cake.  First, add the REST APIManager from the flask.ext.restless extension to the application configuration file.

flask_app/my_app/__init__.py

Just adding the above couple of lines to the existing code should suffice.

flask_app/my_app/catalog/views.py

This file comprises the bulk of the changes from the previous part. Below is the complete rewritten file.

It is pretty self-explanatory how the above code would work. We just imported the manager that was created in a previous file, and it is used to create an API for the Product model with the listed methods. We can add more methods like DELETE, PUT, PATCH, etc. as needed.

Application in Action

Let's test this application by creating some products and listing them. The endpoint created by this extension by default is http://localhost:5000/api/product.

As I did in the last part of this tutorial series, I will test this using the requests library via terminal.

How to Customize

It is really handy to have the RESTful APIs created automatically, but each application has some business logic which calls for customizations, validations, and clever/secure handling of requests as needed. 

Here, request preprocessors and postprocessors come to the rescue. As the names signify, methods designated as preprocessors run before the processing of the request, and methods designated as postprocessors run after the processing of the request. create_api() is the place where they are defined as dictionaries of the request type (GET, POST, etc.) and the methods as list which will act as preprocessors or postprocessors on the specified request. Below is a template example:

The GET, PUT, and PATCH requests have the flexibility of being fired for single as well as multiple records; therefore, they have two types each. In the code above, notice GET_SINGLE and GET_MANY for GET requests. 

The preprocessors and postprocessors accept different parameters for each type of request and work without any return value. This is left for you to try on your own.

Conclusion

In this part of this tutorial series, we saw how to create a RESTful API using Flask just by adding a couple of lines to a SQLAlchemy-based model. 

In the next and last part of this series, I will cover how to create a RESTful API using another popular Flask extension, but this time, the API will be independent of the modeling tool used for the database.


by Shalabh Aggarwal via Envato Tuts+ Code

This Week in Mobile Web Development (#129)

Read this on the Web

Mobile Web Weekly October 12, 2016   #129
Brian Rinaldi recommends
Upgrading Hybrid Apps to Native with NativeScript — An in-depth resource to aid decision making on development technologies and frameworks, plus a guide with advice for devs migrating from hybrid to native.
Nic Raboy, Burke Holland and TJ VanToll
Holly Schinsky recommends
PhoneGap Build Now Accepts Cordova Projects — PhoneGap Build can now accept apps created with the Apache Cordova CLI.
Brett Rudd
Chris Brandrick recommends
AMP Is One Year Old and Growing Fast — There are now 600 million AMP pages on 700,000 domains - Will it ultimately trump responsive design?
Greg Sterling
Sponsored
Join Firebase Dev Summit 2016 in Berlin on Nov. 7th — Featuring two days of talks on Polymer, Web Components, Progressive Web Apps, and the future of the mobile web.
Google Inc.

Holly Schinsky recommends
The Annoying Mobile Double-Tap Link Issue — How to fix the double-tap link issue on iOS.
Chris Coyier
Brian Rinaldi recommends
What’s The Deal With The Samsung Internet Browser? — Chrome for Android is actually several browsers, not just Google Chrome, one of which is the Chromium-based Samsung browser, with about 400M users globally.
Peter-Paul Koch
Chris Brandrick recommends
Integrating React Native Into An Existing Swift App
Ray Wenderlich
Holly Schinsky recommends
A Faster Mobile Web: WordPress.com Updates for Accelerated Mobile Pages — WordPress.com users’ sites now support Accelerated Mobile Pages (AMP).
WordPress
Holly Schinsky recommends
Monitaure: A Server Uptime Monitoring Application — A Progressive Web App project built with React/Redux that serves as a free server monitoring app for Sys Admins.
Bertrand Junqua
Brian Rinaldi recommends
Refreshing The Verge: Facebook Video, Google AMP, and The (Non)Future of The Web — Nilay Patel on the “sad, slow death of the open web”. For The Verge mobile web article pages are quickly becoming the least important thing they make.
The Verge
Holly Schinsky recommends
Google and Progressive Web Apps: The Mobile Experience and SEO — Progressive Web Apps and their implications on SEO performance.
Jim Yu
Holly Schinsky recommends
Is it Time to AMP Up Your Website? — Now that your website is mobile-friendly, can you sit back and relax? Maybe not. The next big thing in the mobile web is Accelerated Mobile Pages.
Laurie Shook and Beth Kahlich
Brian Rinaldi recommends
Xamarin for Cordova – A Bizarre Idea? — The team at Zühlke Germany decided that there were legitimate use cases for this combination and devised strategies to make it work.
Robin Wiegand Kerry Lothrop
Holly Schinsky recommends
Node 0.x and 4.x Deprecation Timeline for Apache Cordova — Recommendations for supported and deprecated node versions to come for Apache Cordova developers.
Apache Cordova
Holly Schinsky recommends
Add Analytics to Your PhoneGap App with Appsee — How to add support for qualitative analytics to your PhoneGap apps.
Appsee
Chris Brandrick recommends
App Size Calculator — Does app size affect install rate? According to Segment’s data every MB matters.
Segment
Brian Rinaldi recommends
How to Use CSS Feature Queries — How CSS Feature Queries can be used to detect support for specific features on different browsers.
Abbey Fitzgerald
Brian Rinaldi recommends
AtoZ CSS Quick Tip: Creating Responsive Design with Media Queries — Tips for writing better media queries for responsive design.
Guy Routledge
Holly Schinsky recommends
Ionic 2 Firebase 3 Facebook Authentication: Full Guide — Build an app with Ionic 2 and Firebase 3 that allows Facebook authentication.
Jave Bratt
Holly Schinsky recommends
Creating Role Based Authentication with Passport in Ionic 2 – Part 1 — How to build an Ionic 2 app with role-based authentication using Passport and the MEAN stack.
Josh Morony
Sponsored
The End of Job Hunting As You Know It — You're on the cutting edge of technology, why job hunt like it's '90s? Try Hired today and have 4,000+ top companies apply for the chance to interview you.
Hired

Curated by Brian Rinaldi and Holly Schinsky for Cooper Press.
Cooper Press is located at Office 30, Fairfield Enterprise Centre, Louth, LN11 0LS, UK
Update your email address
or stop receiving MWW here


by via Mobile Web Weekly

BIGSOUND Buzz

opl-small

Unique and impressive One Pager providing real-time stats of the most talked about artists from BIGSOUND festival 2016 based on social media. What an awesome interactive Vinyl illustration that hosts recent activity about each of the Top 10 artists. Also lovely touch with the infographic switcher from pie (vinyl) to bar graph views.

by Rob Hope via One Page Love

Social Ad Spend Surpasses Television: New Research

mk-social-ad-spend-research-600

Is your company wondering where to allocate its advertising budget? Are you on the fence about whether jumping into social media advertising is worth it? New research shows that for the first time, digital and social media ad spending has surpassed that of TV. Marketers everywhere may revisit their strategies, leading to big changes in [...]

This post Social Ad Spend Surpasses Television: New Research first appeared on .
- Your Guide to the Social Media Jungle


by Michelle Krasniak via

League of Legends - Worlds History

Our WebGL cup runneth over! Access the illustrious history of the League of Legends Worlds Championship through the very thing the players covet above all else - The Summoner's Cup!
by via Awwwards - Sites of the day