Archive for the ‘PHP Tutorials’ Category

15 Interesting JavaScript and CSS Libraries for July 2017

Monday, July 17th, 2017

15-interesting-javascript-and-css-libraries-for-july-2017

A list of our favorite web development resources for the month of July, packed with some awesome new frameworks, vanilla JS libraries, and many other goodies.

Continue reading on Tutorialzine.

Tags: , , ,
Posted in PHP Tutorials | No Comments »

JavaScript Async/Await Explained in 10 Minutes

Monday, July 10th, 2017

javascript-asyncawait-explained-in-10-minutes

A quick introduction into one of the most highly anticipated new JavaScript features.

Continue reading on Tutorialzine.

Tags: , , ,
Posted in PHP Tutorials | No Comments »

15 Essential Plugins for Visual Studio Code

Tuesday, June 27th, 2017

15-essential-plugins-for-visual-studio-code

A collection of some of the best VSCode extensions available, accompanied by helpful video previews.

Continue reading on Tutorialzine.

Tags: , , ,
Posted in PHP Tutorials | No Comments »

Getting Started With WebAssembly

Wednesday, June 14th, 2017

getting-started-with-webassembly

An absolute beginner's guide to WebAssembly in which we write some C code, compile it to wasm, and then run it in the browser.

Continue reading on Tutorialzine.

Tags: , , ,
Posted in PHP Tutorials | Comments Off on Getting Started With WebAssembly

15 Interesting JavaScript and CSS Libraries for June 2017

Monday, June 5th, 2017

Our list of recommended web dev resources for the month of June. It features a plugin for CSS-only tooltips, a JavaScript code formatter, plus other new frameworks and utilities.

Tags: , , ,
Posted in PHP Tutorials | Comments Off on 15 Interesting JavaScript and CSS Libraries for June 2017

Quick Tip: Make IndexedDB a Breeze With LocalForage

Wednesday, May 31st, 2017

A 5-minute introduction to localForage - an awesome JavaScript library for working with browser storage.

Tags: , , ,
Posted in PHP Tutorials | Comments Off on Quick Tip: Make IndexedDB a Breeze With LocalForage

20 Excellent Resources for Learning Kotlin

Wednesday, May 24th, 2017

20-kotlin-resources

Кotlin is a modern programming language that runs on the Java Virtual Machine. It has an elegant syntax and is interoperable with all existing Java libraries. In the 2017 Google I/O, the Android team announced that Kotlin will become an official programming language for the Android platform. This puts Kotlin in position to become one of the top programming languages of the future.

To help you get started with your Kotlin journey, we’ve curated a list of some of the best Kotlin learning resources available right now. We haven’t included any paid courses or books, everything on the list is 100% free.


The Kotlin Website

The official website for the project is a very good place to start your Kotlin education. In the reference section you can find in-depth documentation that covers all the main concepts and features of the language. The tutorials section has a variety of practical step-by-step guides on setting up a working environment and working with the compiler.

There is also the Kotlin editor, a browser app that let’s you try out the language. It is loaded with many examples including the Koans course – by far the best way to get familiar with the syntax.

Keddit: Learn Kotlin while developing an Android App

An excellent 11-part series by Juan Ignacio Saravia in which he puts Kotlin into action and builds a Reddit clone app. The tutorials cover a vast number of topics ranging from setting up the workspace to using APIs and even unit testing. The code is available on GitHub.

Antonio Leiva’s Blog

Antoni Leiva’s blog is dedicated to all things Kotlin. It is updated weekly(ish) with high-quality tutorials and articles in which more advanced Kotlin developers can learn about new libraries and find all kinds of practical techniques.

Android Announces Support for Kotlin

The official Google blog post that explains the reasons behind the exciting announcement and why Kotlin deserves a place in the Android ecosystem. The article then goes on to give a brief preview of some of the awesome syntax improvements that Kotlin brings.

Design Patterns implemented in Kotlin

Dariusz Baciński has created a useful GitHub repo containing common design patterns implemented in Kotlin. There are similar projects written in several languages including Java, Swift, JavaScript, and PHP, so if you are coming from one of these programming background you can use them as a reference point.

Learn X in Y minutes

A quick cheatsheet with some of the most important features and syntax quirks that will help you write better Kotlin code. There are examples on working with classes, loops, and lists, as well as implementations of classic programming problems such as generating a Fibonacci sequence.

The Kotlin Blog

The official blog for Kotlin by its authors at JetBrains. Here you can find all Kotlin related news and updates, as well as all kinds of tutorials, tips, and other useful articles.

Get Started with Kotlin on Android

A helpful article from the Google Developers blog that explains how to setup Android Studio for Kotlin, how to convert .java files to .kt files, and how to incorporate the new language into an existing Android project. There are also some code comparisons on the same Android APIs used with both Kotlin and Java.

Android Testing With Kotlin

Great article that shows us how to write and run tests for Android apps using Kotlin. The author does a great job of explaining what different types of tests are available, when to use them, and how to make sure we are testing properly. Another good tutorial on this topic can be found here.


Introduction to Kotlin

A talk from Google I/O 2017 dedicated to introducing Kotlin to people for the first time and giving them an idea of how it can improve their workflow. It covers many of the basics and showcases some cool Kotlin tips.

Life is Great and Everything Will Be Ok, Kotlin is Here

The second Kotlin talk from Google I/O 2017. This one covers more advanced topics like design patterns, best practices, and other common principles. It also sheds some light on what it is like to use Kotlin in production and the challenges of adopting a young language in the workplace.

Peter Sommerhoff’s Kotlin Tutorials

Here is a free Kotlin course for complete beginners that includes all the basics from variables to conditionals to loops and functions. It then goes on to more advanced topics like object-orientation in Kotlin and functional programming like lambda expressions.

Better Android Development with Kotlin & Gradle

This talk from 2016 consists of a brief overview of the language’s features followed by a real world example where you’ll learn how Kotlin fits in with the existing tools in a typical Android workflow.

Better Android Development with Kotlin & Gradle

A very good 8-minute tutorial that quickly goes over the most important Kotlin features, such as the shortened variable declarations, lambdas, extension function, and more.

Android Development with Kotlin — Jake Wharton

Introduction to Kotlin that explains how the new language will improve the Android ecosystem and shows us a number of cool ways we can use the smart Kotlin syntax to our advantage.


From Java To Kotlin

Useful cheatsheet containing short snippets of code that will help you quickly look up the Kotlin alternatives to common Java operators, functions, and declarations.

Kotlin Educational Plugin

A plugin for IntelliJ IDEs that allows you to take the Koans course in a local offline environment.

Kotlin on GitHub

Kotlin has been open-source for more than 5 years and there is a GitHub repo containing the entire history of the project. If you want to support the language there are multiple ways you can contribute, be it directly or by working on the docs.

Kotlin Android Template

Template Android project that makes it super easy to setup a stable Kotlin workspace and quickly bootstrap your apps.

Awesome Kotlin

An extensive list of Kotlin resources containing all sorts of useful links, books, libraries, frameworks, and videos. The list is very well organized, with a stylized version also available at kotlin.link.

Tags: , , ,
Posted in PHP Tutorials | Comments Off on 20 Excellent Resources for Learning Kotlin

20 Excellent Resources for Learning Kotlin

Wednesday, May 24th, 2017

Get a head start on learning Kotlin with this collection of free tutorials, articles, and video lessons.

Tags: , , ,
Posted in PHP Tutorials | Comments Off on 20 Excellent Resources for Learning Kotlin

Getting Started With The JavaScript Web Animation API

Tuesday, May 16th, 2017

js-animations

Adding animations to web interfaces makes pages and apps feel more responsive and interactive. A side menu that smoothly slides out of view provides a much better user experience then a menu that just disappears when you close it.

So far creating web animations was done either via CSS transitions, CSS keyframes, or an external library such as Animate.css or Velocity. Thanks to a new native JavaScript API, we are now able to freely animate any HTML element without ever having to leave our .js file.

Creating Animations

To showcase the awesomeness of the new API, let’s build a super simple example, once the old-fashioned CSS way, then with JavaScript Web Animations.

The editor below contains two HTML divs that when clicked on move to the right and then change their color. The square is animated via CSS @keyframes, and the circle via the Web Animations API.

(Play with our code editor on Tutorialzine.com)

The @keyframes animation should be familiar to most developers so let’s look at that first.

The CSS Approach

Our CSS animation is defined in a @keyframes block that represents a timeline of all the transitions. Once we have our choreography defined, we can map it to a selector via the animation property and it’s options.

.animate {
    animation-name: move-and-change-color;   
    animation-duration: 0.4s;
    animation-fill-mode: forwards;
}

@keyframes move-and-change-color {
    0% {
        transform: translateX(0);
    }

    80% {
        transform: translateX(100px);
        background-color: #2196F3;
    }

    100% {
        transform: translateX(100px);
        background-color: #EF5350;
    }
}

We want the animation to start on user interaction so we will also have to create an on-click event listener that adds a CSS class to the desired element:

var square = document.getElementById('square');
    
square.addEventListener('click', function() {
    square.className += " animate";
});

Although it works pretty well, the CSS approach seems rather non-intuitive as we define what happens in the stylesheets, but actually start it in the JavaScript. We also have very limited control over the animation once it has been invoked. Both these problems can be solved by switching to the Web Animation API.

The JavaScript Approach

We can describe our JavaScript animation using almost the exact same transitions we used in the CSS example:

var moveAndChangeColor = [
    { 
        transform: 'translateX(0)',
        background: '#2196F3'    // blue
    },
    { 
        offset: 0.8,
        transform: 'translateX(100px)', 
        background: '#2196F3'    // blue
    },
    {
        transform: 'translateX(100px)',
        background: '#EF5350'    // red
    }
];

Each object in the array represents a state of the animation. The states are evenly distributed in time (3 states – 0%, 50%, 100%) unless we change the timing using the offset option, as we’ve done with the middle state.

After we’ve defined our animation array, we can invoke it using the animate() method. It takes as a second argument an object with the same options as the CSS animation property, although with slightly different names (e.g. animation-fill-mode is fill, animation-iteration-count is iteration, etc).

var circle = document.getElementById('circle');
  
circle.addEventListener('click', function() {
    circle.animate(moveAndChangeColor, {
        duration: 400,
        fill: 'forwards'
    });
});

As you can see, the JavaScript approach is much more organized with the animation stored in a variable and the animate() method used for invoking it whenever we need to.

Controlling Animations

The Web Animation API also makes it possible to easily control the playback of an animation in a number of ways. The animate() method returns an Animation object which we can save in a variable and use to refer to that animation later on.

var animation = elem.animate(transitions, options);

The interface provides us with the following methods:

Below is a tiny demo with a loading indicator that loops infinitely. We’ve setup buttons for the different events so that you can try them out:

(Play with our code editor on Tutorialzine.com)

Properties and Events Listeners

The Animation object returned from animate() holds several useful properties that give us access to options like the current time, the playback rate, and others. Although some are read-only, most of the properties can be used as setters and getters.

You can view the JS code in the editor below to get a sense of how they work. For the full list of properties visit MDN.

(Play with our code editor on Tutorialzine.com)

In addition to that, the Web Animation API provides us with two useful event handlers for when the animation has finished or has been canceled:

spinnerAnimation.addEventListener('finish', function() {
    // Animation has completed or .finish() has been called.
    doSomething();
});

spinnerAnimation.addEventListener('cancel', function() {
    // Animation has been canceled.    
    doSomething();
});

Support and Performance

Most of the Web Animation features are freely available in Chrome and Firefox, with Edge and Safari implementations in the working (caniuse). There is also a well maintained open-source polyfill which can be used while waiting for full browser coverage.

When it comes to performance, there shouldn’t be any difference compared to regular CSS transitions, as browsers use the same engine for both. If you stick to animating only properties that don’t cause redraws, such as transform and opacity, animations should keep a steady 60fps rate.

Conclusion

The Web Animation API gives developers an awesome new way to create and control web animations using nothing but pure JavaScript. For animations that are invoked on user interaction or other dynamic events, this is great news since the whole animation can be done in the controller code, without having to jump to a CSS file for the actual transitions.

This article covered most of the features of the new API, but if you want to learn more here are a couple of excellent resources we highly recommend:

Tags: , , , ,
Posted in PHP Tutorials | Comments Off on Getting Started With The JavaScript Web Animation API

Getting Started With The JavaScript Web Animation API

Tuesday, May 16th, 2017

In this quick tutorial we take a look at a powerful native JavaScript API that makes animating on the web easier then ever.

Tags: , , ,
Posted in PHP Tutorials | Comments Off on Getting Started With The JavaScript Web Animation API