Getting React Projects Ready Fast with Pre-configured Builds

SitePoint - Wed, 09/06/2017 - 12:00

Starting a new React project now days is not as simple as we'd like it to be. Instead of instantly diving into the code and bringing your application to life, you have to spend time configuring the right build tools to set up a local development environment, unit testing, and a production build. But there are projects where all you need is a simple set up to get things running quickly and with minimal efforts.

Create-react-app provides just that. It's a CLI tool from Facebook which allows you to generate a new React project and use a pre-configured Webpack build for development. Using it, you will never have to look at the Webpack config again.

How does create-react-app work?

Create-react-app is a standalone tool which should be installed globally via npm, and called each time you need to create a new project.

npm install -g create-react-app

To create a new project, run:

create-react-app react-app

Create-react-app will set up the following project structure:

. ├── .gitignore ├── README.md ├── package.json ├── node_modules ├── public │ ├── favicon.ico │ └── index.html └── src ├── App.css ├── App.js ├── App.test.js ├── index.css ├── index.js └── logo.svg

It will also add a react-scripts package to your project which will contain all of the configuration and build scripts. In other words, your project depends react-scripts, not on create-react-app itself. Once the installation is complete, you can start working on your project.

Starting a Local Development Server

The first thing you'll need is a local development environment. Running npm start will fire up a Webpack development server with a watcher which will automatically reload the application once you change something. Hot reloading, however, is only supported for styles.

The application will be generated with a number of features built-in.

ES6 and ES7

The application comes with its own Babel preset, babel-preset-react-app, to support a set of ES6 and ES7 features. It even supports some of the newer features like async/await, and import/export statements. However, certain features, like decorators, have been intentionally left out.

Continue reading %Getting React Projects Ready Fast with Pre-configured Builds%

10 Unexpected Sources of Design Inspiration

SitePoint - Tue, 09/05/2017 - 13:00

There's a source of inspiration for every type of design you can think of. Struggling to create the perfect font pairing? Head to Typewolf. Searching for ideas for your website redesign, or a specific webpage? Browse Crayon. Looking for all-around epic sources of design inspiration? Check out the latest crop of Webby Award winners.

But as awesome as these collections are, it's dangerous to rely on them exclusively. If all designers are referencing the same ideas, concepts and templates from the same websites for design inspiration, every design then sort-of becomes a variation of an existing one. It's almost impossible to create something novel or unique, when all designers are basing their ideas on the same inspiration sources.

Luckily, there's a solution for that...

Throw some new sources of design inspiration into the mix, alongside your regular sources! These 10 websites will keep you inspired in unexpected ways.

1. 99% Invisible

99% Invisible is a blog and radio show hosted by Roman Mars. It delves into the unnoticed yet beautiful, intriguing and significant forces that shape our world.

In other words…the 99%.

Each episode is approximately 15-25 minutes long and covers a single topic related to architecture, objects, visuals, history, technology, society, cities, sounds and infrastructure. Not only will it help you look at your surroundings with fresh eyes, but it'll help you hone your attention to detail. It's the "little things" that often make or break a design, so an enhanced focus on little details is definitely a skill worth mastering.

2. The Dieline

My grocery trips have been taking twice as long since I discovered The Dieline. This epic website features at least one innovative packaging design per day, but often shares two or three. You'll be both surprised and delighted to see how the most mundane items (like pencils) can be elevated by logo design and clever packaging.

The fundamentals of design apply to packaging like any other aspect of design. For example, if there's not enough white space in the design on a bag of coffee, it'll look crowded and strain the consumer's eyes when they're trying to read it in the supermarket, resulting in a loss of sale. Because these design concepts carry over in many ways, scrolling through The Dieline will reinforce your existing design knowledge regardless of whether you're you're a logo, web or user interface designer.

3. The Great Discontent (TGD)

The Great Discontent is a print and digital magazine showcasing all types of creatives from photographers and graphic designers to illustrators and filmmakers. Unlike many other design inspiration sources, TGD features the astonishing designers behind the work, not the only works themselves.

Sometimes it can be even more inspiring to read about an artist's beginnings, their current projects, and the biggest challenges they've faced, than to see the work itself.

After all, creative work can be emotionally draining, since you're not using up both your physical and mental strength equally, but rather 100% (and sometimes more!) of your mental strength. Knowing that others can relate often rejuvenates you and inspires you to carry on. You'll also learn how other creatives generate their amazing ideas.

4. Design Milk

Design Milk never lets me down when I need straight-up visual eye-candy. This online magazine curates the best art, interior design, furniture, fashion, technology and architecture from around the world. The photographs are stunning, the cultures and aesthetics are stylistically varied but universally interesting, and the writing is solid. If you need bursts of inspiration from a variety of different art concepts, Design Milk is definitely for you.

And, if you're only interested in a specific vertical—say, architecture—it's easy to filter out other content and narrow down your search.

5. Style Guides by Brad Frost

Nothing fuses the creative and the orderly together like a style guide. Brad Frost, well-known front-end designer and author of Atomic Design, created Style Guides to house an ever-growing collection of resources on the topic. The Talks and Tools sections are certainly worth scrolling through, although my favorite is Examples. You'll find some of the most well-crafted style guides in existence, from the biggest brands today.

Better yet, you can sort through them by their content.

6. Card Nerd

Counterintuitively, rules and restrictions often inspire some of the most inventive designs. After all, they force you to find unexpected solutions and workarounds, where a "no-limits" approach has the tendency to make designers feel lazy.

This explains why business cards are a reliable source of inspiration. A business card designer has a tiny medium for a big task: communicating someone's professional identity. Whenever you're struggling to pare down your copy to the essentials, or make a design feel less busy, use Card Nerd. This gallery is updated several times a day with new business cards, ranging from minimalist to bold and colorful.

Continue reading %10 Unexpected Sources of Design Inspiration%

React vs Angular: An In-depth Comparison

SitePoint - Tue, 09/05/2017 - 12:00

Should I choose Angular, or React? Today's bipolar landscape of JavaScript frameworks has left many of developers struggling to pick a side in this debate. Whether you're a newcomer trying to figure out where to start, a freelancer picking a framework for your next project or an enterprise-grade architect planning a strategic vision for your company, you're likely to benefit from having an educated view on this topic.

To save you some time, let me tell you something up front: this article won't give a clear answer on which framework is better. But neither will hundreds of other articles with similar titles. I can't tell you that because the answer depends on a wide range of factors which make a particular technology more or less suitable for your environment and use case.

Since we can't answer the question directly, we'll attempt something else. We'll compare Angular (2+, not the old AngularJS) and React to demonstrate how you can approach the problem of comparing any two frameworks in a structured manner on your own and tailor it to your environment. You know, the old "teach a man to fish" approach. That way, when both are replaced by a BetterFramework.js in a year's time, you will be able to re-create the same train of thought once more.

Where to Start?

Before you pick any tool you need to answer two simple questions: "Is this a good tool per se?" and "Will it work well for my use case?" None of them mean anything on their own, so you always need to keep both of them in mind. All right, the questions might not be that simple, so we'll try to break them down into smaller ones.

Questions on the tool itself:

  • How mature is it and who's behind it?
  • What kind of features does it have?
  • What architecture, development paradigms, and patterns does it employ?
  • What is the ecosystem around it?

Questions for self-reflection:

  • Will I and my colleagues be able to learn this tool with ease?
  • Does is fit well with my project?
  • What is the developer experience like?

Using this set of questions you can start your assessment of any tool and we'll base our comparison of React and Angular on them as well.

There's another thing we need to take into account. Strictly speaking, it's not exactly fair to compare Angular to React, since Angular is a full-blown feature-rich framework, and React just a UI component library. To even the odds, we'll talk about React in conjunction with some of the libraries often used with it.

Maturity

An important part of being a skilled developer is being able to keep the balance between established, time-proven approaches and evaluating new bleeding-edge tech. As a general rule, you should be careful when adopting tools which have not yet matured due to certain risks:

  • The tool might be buggy and unstable.
  • It might be unexpectedly abandoned by the vendor.
  • There might not be a large knowledge base or community available in case you need help.

Both React and Angular come from good families, so it seems that we can be confident in this regard.

React

React is developed and maintained by Facebook and used in their own products, including Instagram and WhatsApp. It has been around for roughly three and a half years now, so it's not exactly new. It's also one of the most popular projects on GitHub with about 60,000 stars at the time of writing. Sounds good to me.

Angular

Angular (version 2 and above) has been around less then React, but if you count in the history of its predecessor, AngularJS, the picture evens out. It's maintained by Google and used in AdWords and Google Fiber. Since AdWords is one of the key projects in Google, it is clear they have made a big bet on it and is unlikely to disappear anytime soon.

Features

Like I mentioned earlier, Angular has more features out of the box than React. This can be both a good and a bad thing, depending on how you look at it.

Both frameworks share some key features in common: components, data binding, and platform-agnostic rendering.

Angular

Angular provides a lot of the features required for a modern web application out of the box. Some of the standard features are:

  • Dependency injection;
  • Templates, based on an extended version of HTML;
  • Routing, provided by @angular/router;
  • Ajax requests by @angular/http;
  • @angular/forms for building forms;
  • Component CSS encapsulation;
  • XSS protection;
  • Utilities for unit-testing components.

Having all of these features available out of the box is highly convenient when you don't want to spend time picking the libraries yourself. However, it also means that you're stuck with some of them, even if you don't need them. And replacing them will usually require additional effort. For instance, we believe that for small projects having a DI system creates more overhead than benefit, considering it can be effectively replaced by imports.

React

With React, you're starting off with a more minimalistic approach. If we're looking at just React, here's what we have:

  • No dependency injection;
  • Instead of classic templates it has JSX, an XML-like language built on top of JavaScript;
  • XSS protection;
  • Utilities for unit-testing components.

Not much. And this can be a good thing. It means that you have the freedom to choose whatever additional libraries to add based on your needs. The bad thing is that you actually have to make those choices yourself. Some of the popular libraries that are often used together with React are:

We've found the freedom of choosing your own libraries liberating. This gives us the ability to tailor our stack to particular requirements of each project and we didn't find the cost of learning new libraries that high.

Languages, Paradigms, and Patterns

Taking a step back from the features of each framework, let's see what kind higher-level concepts are popular with both frameworks.

React

There are several important things that come to mind when thinking about React: JSX, Flow, and Redux.

JSX

JSX is a controversial topic for many developers: some enjoy it, and others think that it's a huge step back. Instead of following a classical approach of separating markup and logic, React decided to combine them within components using an XML-like language that allows you to write markup directly in your JavaScript code.

While the topic of mixing markup with JavaScript might be debatable, it has an indisputable benefit: static analysis. If you make an error in your JSX markup, the compiler will emit an error instead of continuing in silence. This helps by instantly catching typos and other silly errors. This is something we really miss in Angular.

Flow

Continue reading %React vs Angular: An In-depth Comparison%

A Guide to Setting Up Let’s Encrypt SSL on Shared Hosting

SitePoint - Tue, 09/05/2017 - 11:00

In recent years, there's been a strong push by Google and others to make the web more secure by encouraging the use of TLS/SSL (transport layer security/secure sockets layer) on every website.

Google has added extra encouragement for using HTTPS by giving a ranking boost to sites, and, like other browser makers, is gradually turning up the heat in Chrome by introducing increasingly alarming alerts on sites without encryption.

Until recently, SSL certificates were quite costly. Let's Encrypt changed that by offering free certificates.

There are lots of online tutorials showing how to install Let's Encrypt certificates, but they tend to require quite a bit of technical expertise (knowledge of how to operate a Linux web server and manage root access) and rarely guide you on how to install it through a common shared hosting control panel. If your cPanel or other control panel instance doesn't provide a feature like One Click Install for Let's Encrypt SSL (and many don't), then you may feel there's no option but to fork out money for a certificate through your web hosting provider.

However, in this article I'll show you how to install a Let's Encrypt SSL certificate on your shared web hosting server using the services from SSL For Free. SSL For Free allows you to install a Let's Encrypt SSL certificate without having to have root access and a VPS, but just a regular shared web hosting server.

Installing Let's Encrypt SSL Using SSL For Free

Step 1: Head over to the SSL For Free website.

Step 2: In the enter your website to secure input box, type your website domain address (for example: yourdomain.com).

Step 3: SSL For Free will provide SSL certificates for yourdomain.com and www.yourdomain.com automatically.

Step 4: If you want to add another subdomain (for example: sub.yourdomain.com), click the Add / Edit Domains link, and you'll be returned to the domain address input page.

Step 5: Add the subdomain you desire in the input box.

Verify your domain and/or subdomain by SSL For Free

There are three ways to verify your domain by SSL For Free (you can choose any one of them).

  1. The first is via Automatic FTP Verification. Here, you'll be asked for data about your web hosting FTP account.
  2. The second is through Manual Verification. You'll be prompted to download two files from SSL For Free, which you'll later upload to your web hosting server.
  3. The third is through Manual Verification (DNS). This way, you'll be prompted to create a new TXT record through your web hosting control panel.

Let's take a look at each of the verification steps.

Method 1. Automatic FTP Verification

Step 1: Click the Automatic FTP Verification button.

Step 2: Below this, you'll be prompted to input data from your web hosting FTP account. Input the data completely:

If you feel uncomfortable with this way (giving your FTP account access data), then you can choose the second way (which I highly recommend) below.

Method 2. Manual Verification

Step 1: You'll be prompted to download two files generated by SSL For Free, which you'll then upload to your web hosting server. Click Manual Verification. (Note: don't close this tab/page!)

Step 2: Below, you'll be prompted to download two files generated by SSL For Free. Download both files, saving them on your local computer.

Step 3: In accordance with the instructions of this SSL For Free page, create a new folder/directory called .well-known. (If you're in a Windows environment, name it .well-known. --- that is, with an extra dot at the end.) Inside that directory, create a new directory called acme-challenge. Copy-paste the two downloaded files into the acme-challenge directory.

Step 4: Now upload both files to your web hosting server using your preferred FTP application (such as FileZilla).

Step 5: Upload the .well-known directory from your local computer to the root directory of your web hosting server (its directory, not the contents in it).

Step 6: Now open a new tab/page in your browser and enter your domain URL, along with the location of the two files. Make sure you see the random numbers and letters:

Step 7: Go back to the SSL For Free tab/page (page at Step 1) and click Download SSL Certificate. Make sure you don’t get a reply like this:

Step 8: If you get an error reply, please repeat Step 1 above, until SSL For Free loads the Loading SSL Certificate Account page. It will then proceed to the Generating SSL Certificate Securely page:

Method 3. Manual Verification (DNS)

In this last verification method option, you'll be prompted to create a new TXT record in your web hosting control panel.

Here's what the steps look like in cPanel:

Step 1: Click the Manual Verification (DNS) button on the SSL For Free site.

Step 2: You'll then be prompted to create a new TXT record according to the data on that page:

Step 3: Open a new tab/page in your browser and log in to CPanel on your server. Go to Zone Editor, and add a record with the following data:

  • Type: TXT
  • Name: _acme-challenge.yourdomain.com.
  • TTL: 14400
  • TXT Data: [corresponding to the first TXT Record data in Step 2]

Click Add Record:

Step 4: Then add the second new TXT record with the following data:

  • Type: TXT
  • Name: _acme-challenge.www.yourdomain.com.
  • TTL: 14400
  • TXT Data: [corresponding to the second TXT Record data in Step 2]

Once again, click Add Record.

Step 5: The final result will look something like this:

Step 6: Go back to the SSL For Free tab/page (page at Step 1) and click the Download SSL Certificate. If you've set up the TXT records correctly, you should get a couple of results like this:

Step 7: You'll be taken to the Loading SSL Certificate Account page, and then to the Generating SSL Certificate Securely page:

Continue reading %A Guide to Setting Up Let’s Encrypt SSL on Shared Hosting%

Building a Trello Layout with CSS Grid and Flexbox

SitePoint - Tue, 09/05/2017 - 09:00

In this tutorial, I’ll walk you through an implementation of the basic layout of a Trello board screen (see example here). This is a responsive, CSS-only solution, and only the structural features of the layout will be developed.

For a preview, here is a CodePen demo of the final result.

Besides Grid Layout and Flexbox, the solution employs calc and viewport units. To make the code more readable and efficient, I’ll also take advantage of Sass variables.

No fallbacks are provided, so make sure to run the code in a supporting browser. Without further ado, let’s dive in, developing the screen components one by one.

The Screen Layout

The screen of a Trello board consists of an app bar, a board bar, and a section containing the card lists. I’ll build this structure with the following markup skeleton:

[code language="html"]
<div class="ui">
<nav class="navbar app">...</nav>
<nav class="navbar board">...</nav>
<div class="lists">
<div class="list">
<header>...</header>
<ul>
<li>...</li>
...
<li>...</li>
</ul>
<footer>...</footer>
</div>
</div>
</div>
[/code]

This layout will be achieved with a CSS Grid. Specifically, a 3x1 grid (that is, one column and three rows). The first row will be for the app bar, the second for the board bar, and the third for the .lists element.

The first two rows each have a fixed height, while the third row will span the rest of the available viewport height:

[code language="sass"]
.ui {
height: 100vh;
display: grid;
grid-template-rows: $appbar-height $navbar-height 1fr;
}
[/code]

Viewport units ensure that the .ui container will always be as tall as the browser’s viewport.

A grid formatting context is assigned to the container, and the grid rows and columns specified above are defined. To be more precise, only the rows are defined because there is no need to declare the unique column. The sizing of the rows is done with a couple of Sass variables for the height of the bars and the fr unit to make the height of the .lists element span the rest of the available viewport height.

The Card Lists Section

As mentioned, the third row of the screen grid hosts the container for the card lists. Here’s the outline of its markup:

[code language="html"]
<div class="lists">
<div class="list">
...
</div>
...
<div class="list">
...
</div>
</div>
[/code]

I’m using a full viewport-width Flexbox single-line row container to format the lists:

[code language="sass"]
.lists {
display: flex;
overflow-x: auto;
> * {
flex: 0 0 auto; // 'rigid' lists
margin-left: $gap;
}
&::after {
content: '';
flex: 0 0 $gap;
}
}
[/code]

Assigning the auto value to the overflow-x property tells the browser to display a horizontal scrollbar at the bottom of the screen when the lists don’t fit in the width provided by the viewport.

Continue reading %Building a Trello Layout with CSS Grid and Flexbox%

How to Tell if React is the Best Fit for Your Next Project

SitePoint - Mon, 09/04/2017 - 13:00

Nowadays, users expect sleek, performant web applications that behave more and more like native apps. Techniques have been devised to decrease the waiting time for a website to load on a user's first visit. However, in web applications that expose a lot of interactivity, the time elapsing between a user action taking place and the app's response is also important. Native apps feel snappy, and web apps are expected to behave the same, even on less than ideal internet connections.

A number of modern JavaScript frameworks have sprung up that can be very effective at tackling this problem. React can be safely considered among the most popular and robust JavaScript libraries you can use to create fast, interactive user interfaces for web apps.

In this article, I'm going to talk about what React is good at and what makes it work, which should provide you with some context to help you decide if this library could be a good fit for your next project.

What Is React?

React is a Facebook creation which simply labels itself as being a JavaScript library for building user interfaces.

It's an open-source project which, to date, has raked in over 74,000 stars on GitHub.

React is:

  • Declarative: you only need to design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes.
  • Component-based: you create your React-powered apps by assembling a number of encapsulated components, each managing its own state.
  • Learn Once, Write Anywhere: React is not a full-blown framework; it's just a library for rendering views.
How Does the Virtual DOM Work?

The Virtual DOM is at the core of what makes React fast at rendering user interface elements and their changes. Let's look closer into its mechanism.

The HTML Document Object Model or DOM is a

programming interface for HTML and XML documents. … The DOM provides a representation of the document as a structured group of nodes and objects that have properties and methods. Essentially, it connects web pages to scripts or programming languages. — MDN

Whenever you want to change any part of a web page programmatically, you need to modify the DOM. Depending on the complexity and size of the document, traversing the DOM and updating it could take longer than users might be prepared to accept, especially if you take into account the work browsers need to do when something in the DOM changes. In fact, every time the DOM gets updated, browsers need to recalculate the CSS and carry out layout and repaint operations on the web page.

React enables developers to make changes to the web page without having to deal directly with the DOM. This is done via the Virtual DOM.

The Virtual DOM is a lightweight, abstract model of the DOM. React uses the render method to create a node tree from React components and updates this tree in response to changes in the data model resulting from actions.

Each time there are changes to the underlying data in a React app, React creates a new Virtual DOM representation of the user interface.

Updating UI Changes with the Virtual DOM

When it comes to updating the browser’s DOM, React roughly follows the steps below:

  • Whenever something changes, React re-renders the entire UI in a Virtual DOM representation.
  • React then calculates the difference between the previous Virtual DOM representation and the new one.
  • Finally, React patches up the real DOM with what has actually changed. If nothing has changed, React won't be dealing with the HTML DOM at all.

One would think that such a process, which involves keeping two representations of the Virtual DOM in memory and comparing them, could be slower than dealing directly with the actual DOM. This is where efficient diff algorithms, batching DOM read/write operations, and limiting DOM changes to the bare minimum necessary, make using React and its Virtual DOM a great choice for building performant apps.

Continue reading %How to Tell if React is the Best Fit for Your Next Project%

Rapid Development of Zend Expressive Modules

SitePoint - Mon, 09/04/2017 - 12:00

I have learned a few tricks when writing Zend Expressive modules that I want to share with you.

Please follow the previous post first to set up a proper working environment. I explained how to install and configure Zend Expressive with Doctrine, Gulp, and an abstract reflection factory - it'll take a total of 10 minutes.

In this tutorial, we'll build a simple read-only blog module (a page listing blog posts from a database) in minutes, demonstrating the kind of rapid development one is capable of with Zend Expressive.

Module Setup

Run this command from your expressive app to get started:

./vendor/bin/expressive module:create Blog

This will generate some base code for a Blog module and will register your module automatically with your application. It will also register your module with the Composer autoloader.

Doctrine Entity and Database Table

Let's make our Blog entity and database tables. First, we need to let our application know that this module provides Doctrine entities.

Open src/Blog/src/ConfigProvider.php and add the following:

public function __invoke() { return [ 'dependencies' => $this->getDependencies(), 'doctrine' => $this->getDoctrine(), 'templates' => $this->getTemplates(), ]; } /** * @return array */ public function getDoctrine(): array { return [ 'driver' => [ 'orm_default' => [ 'drivers' => [ 'Blog\Entity' => 'blog_entity', ], ], 'blog_entity' => [ 'class' => \Doctrine\ORM\Mapping\Driver\SimplifiedYamlDriver::class, 'cache' => 'array', 'paths' => [ dirname(__DIR__) . '/config/doctrine' => 'Blog\Entity', ], ], ], ]; }

Create a blog post entity config at src/Blog/config/doctrine/BlogPost.orm.yml:

--- Blog\Entity\BlogPost: type: entity table: blog_post id: id: type: integer generator: strategy: AUTO fields: title: type: string length: 255 content: type: string length: 16777215

Then, run ./vendor/bin/doctrine orm:generate-entities src.

Continue reading %Rapid Development of Zend Expressive Modules%

Why Developers Should Consider WordPress.com Hosting

SitePoint - Mon, 09/04/2017 - 11:00

What if you could forget about updates, security patches, latency glitches, and bandwidth/disk space issues? Automattic, the company behind WordPress, has provided a hosting service so comprehensive that it even allows installation of third-party plugins and templates.

WordPress (WP) is not only the most popular content management system, but as of August 2017 it powers 28.5% of all of the web (see "Usage Statistics and Market Share of Content Management Systems for Websites"). This is largely because site owners are running a copy of the free software provided at WordPress.org (WP.org) on their own servers.

Hosting your own copy of WP gives you the freedom add plugins, tweak templates and customize the behavior of the software, but it does have downsides such as dealing with lots of updates, security problems, and issues we'll discuss in a moment.

WP also offers a hosted version of its software at WordPress.com. Developers have tended to avoid this option, mainly because it offers considerably less control over customization, no custom templates and no plugins. But at the same time there are advantages, such as automatic updates, much tighter security, and global distribution. And more recently, WP.com has addressed some of its limitations and started offering a lot more control over the ways in which you can customize the software --- even letting you install add-ons.

In this article, we’ll look at what you can and can’t do with a WP.com site, and I’ll offer reasons to why you might reconsider WP.com over the self-hosting option.

WordPress.com: SaaS!

SaaS stands for Software as a Service. Essentially, the software itself --- in this case, WordPress --- is the service. And with the software also comes all of of the infrastructure that's needed to run it, and you don't need to worry about server resources and all of what's needed to run and manage a WP installation.

WP.com is the official hosting supported by Automattic, the company that handed the WordPress trademark to the WordPress Foundation in 2010. Matt Mullenweg, the creator of WP, is the CEO and founder of Automattic, the company for all things WordPress. This is WP in the cloud.

What you get for using a service like WP.com is the peace of mind that things won't get broken even of you leave them entirely unattended. But let's see in detail how switching out from a shared hosting plan to WP.com can simplify things.

Updates and upgrades

When running your own, self-hosted copy of WP, you need to perform regular updates in order to keep your installation safe. The engineering team at WP made the process really smooth, so if you have set certain writing permissions right, this is something that shouldn’t take you more than a minute or two. Still, you’ll need to do that on a somewhat regular basis. A lot of sites get out of date quickly, providing a lot of scope for hackers to get busy.

Then you have the upgrades. Consider these scenarios:

  • an update going from, let's say, version 4.8 to 4.8.1
  • an upgrade from 4.7 to 4.8
  • a mayor upgrade going from version 3.9 to 4.0.

The first, "update" type is normally smooth, with just security and performance issues are involved.

Upgrades can sometimes be problematic, since new features are introduced.

But major upgrades are almost guaranteed to be a pain, with templates and plugins needing to be rewritten in order to work properly with the upgraded API.

Since WP.com is run by the same folks who maintain the WP.org codebase, all of the updates and upgrades are smoothly synchronized from one to the next.

Load balancing and global distribution

Performance matters today more than ever. With developers under pressure to deliver sites fast, it’s not enough to throw a site on shared hosting and leave it at that. Issues like load balancing, and CDNs to deliver content globally immediately, have become a big consideration when setting up a site.

If your sites have an international audience, you'll always have the visitors near to the data center accessing your site very fast, but the more you get away from it, the less responsive your sites will become (e.g: having a site hosted on the US West Cost, and accessing it from Europe.)

WP.com provides load balancing out of the box. No matter now big your site, no matter how much traffic it has, or globally distributed your audience is, WP.com can handle all of it, and more. And it also comes with the benefits of what a cloud hosting service is (see "A Comparison of Shared and Cloud Hosting, and How to Choose"), including being part of a network distributed across the globe, which makes your site nearly instantly available, no matter if accessed from Shanghai, Rome, Johannesburg, New York City, or Rio de Janeiro.

Server upgrades and maintenance

And the same goes with the software that WP relies to run --- PHP and MySQL. Every once in a while, your hosting company will go through a mayor upgrade, with plenty of notification emails, documentation and tutorials on how to make the transition, setting the company's forums on fire. Again, server upgrades don't happen often, but when they do it's a time consuming process that involves things various things up again, testing, and the risk of getting your sites broken if you failed to do transition properly.

If you have a couple of WP installations, the maintenance time will add up, and you'll need to be very methodical to avoid problems in the mid and long run. And the more diverse your clientele, the more servers you'll need to keep an eye on, and the less you'll be able to simplify updates.

WP.com engineers maintain all of the infrastructure for you, and even mayor upgrades (both software and hardware) are handled smoothly. This is the magic of SaaS, where the software itself is the service, and you don't need to worry about anything else other than just using it.

Because of the best DevOps practices, you won't ever find out that such mayor changes happened to the infrastructure. And this won't affect your site's uptime, which will be 100% even during mayor software and hardware upgrades.

Security

A problem of not performing updates in time is that you'll end up with an insecure WP installation where any script kiddie can take control over your sites, by just scanning vulnerable WP versions on the web.

Also, even if your self-hosted WP instance is up to date, it only takes an unattended vulnerability on the server for a more skilled cracker to take over. And while this doesn't happen all the time, it's something many of us have painfully experienced.

Every patch is applied to WP.com as soon as it comes available to WP.org. Also, because of the globally distributed nature of the cloud, the impact of DDoS attacks is heavily minimized. And even in the event of a zero-day exploit being used on WP.com to compromise its websites, as soon as the attack is detected the engineers will immediately reverse the bogus changes and patch the security hole.

Already on a Dedicated Server or Managed Plan? Think Again!

A dedicated server is the power version of a shared hosting plan, or should I say, a "shared hosting plan" without the "shared" part.

Effectively, you'll have more "dedicated" resources, such as bandwidth, CPU, RAM memory, disk space. But in essence, you're still not solving any of the problems described above, so in this sense a dedicated server offers little added value.

And you'll pay a lot for it! The long-term costs of having a dedicated server can be around a $1000/yr. And with just three dedicated servers running a couple of WP sites, you can very easily reach the $500/mo mark.

Turns out that a more cost-effective solution is available, that will not only assign you as much bandwidth, CPU, RAM and space as you can possibly need, but it will also solve all of the above mentioned issues at the same time.

Continue reading %Why Developers Should Consider WordPress.com Hosting%

Learning JavaScript: 9 Common Mistakes That Are Holding You Back

SitePoint - Thu, 08/31/2017 - 16:00

A lot of people try to learn JavaScript and then give up. Then they tell themselves things like, "JavaScript is too confusing," or worse, "Maybe I'm not cut out for web development."

The sad part? There was no need to give up. All that was needed was a different learning approach.

In this article, we'll cover some of the most common learning mistakes people make and find out how to avoid them. Many of these tips will be applicable outside of JavaScript or even web development, so there's that bonus too.

Let's dive in!

Mistake #1: Overanalyzing Instead of Getting Started

It can be tempting to look for all the information you can get before you start learning JavaScript. If you look, you'll find information about how JavaScript is the best thing ever or the worst thing ever, or that you need to be on this framework or that framework. You might also hear that you need to write JavaScript a certain way or else you'll never be a "real" developer.

Whether or not these points have validity, nothing is worse than the six months to a year you'll waste agonizing instead of starting.

Just type one line of code. It doesn't have to be perfect. It can be terrible. If you get started, you've already passed one of the hurdles that stop a lot of people.

Mistake #2: Learning a Framework Before Learning Plain JavaScript

JavaScript frameworks are built on top of vanilla JavaScript, so if you understand JavaScript, you automatically understand the fundamentals of how to use any JavaScript framework.

However, if you jump straight into a framework, you'll end up memorizing without understanding. It's like trying to write sentences without knowing what words mean. You'll end up memorizing random phrases instead of understanding how words work and how to put them together to make your own sentences.

If you go straight to a framework it'll be harder to learn and you'll have a harder time adapting to another framework if you need to. If you learn plain JavaScript first, you have a firm basis to understand all the frameworks.

Mistake #3: Moving to the Next Step Too Soon

One of the most common mistakes is to move on immediately after understanding a concept.

I've definitely struggled with this one because it's tempting to move forwards once you understand something.

What helped was to treat each concept like a new toy; That means taking some time to enjoy what you just learned. Play around, experiment, see if you can do something new with it. You'll learn a lot that way, and you'll remember better as well.

Once you feel like you can apply a concept in your sleep, move on. It takes a little bit more time up front, but soon it makes everything go much faster.

On the other hand, if you rush, you'll end up forgetting and having to backtrack for every little thing. That ends up taking way more time, and it can be discouraging. In fact, this is a common reason people have said they quit JavaScript.

Mistake #4: Not Breaking Concepts Into Small Enough Pieces

Learning is like a staircase: If you can take one step, you can keep taking more steps until you reach your goals. When something is tough to understand, it's often because you're trying to take a flying leap instead of going one step at a time. Of course, it seems impossible!

Continue reading %Learning JavaScript: 9 Common Mistakes That Are Holding You Back%

How to Create CSS Conic Gradients for Pie Charts and More

SitePoint - Wed, 08/30/2017 - 14:00

More and more websites use gradients in one way or another. Some websites use them for navigation components, while others use them in elements like buttons, or with images to create some nice effects.

All browsers have had support for basic CSS linear and radial gradients for a long time now. The CSS Gradients: A Syntax Crash Course article on SitePoint gives you a quick summary of the syntax required to create linear and radial gradients, as well as how to use repeating gradients to create some basic patterns, which is great if you care about web performance and try to avoid using images whenever possible.

After linear and radial gradients, browsers are now slowly starting to support conic gradients, which were first championed by Lea Verou.

In this article, you will learn about the syntax, uses, and browser support for simple conic gradients and repeating conic gradients.

What are Conic Gradients?

Conic and radial gradients are similar in the sense that both of them start from a specified or default point as the center of the circle used to draw them. The difference between the two is that, in the case of radial gradients the color-stops are placed along the radial line, while in the case of conic gradients the color stops are placed along the circumference of the circle.

The position of color-stops for a conic gradient can be specified either in terms of percentage or in terms of degrees. A value of 0% or 0deg refers to the top of the conic gradient. The values keep increasing gradually as you move clockwise. A value of 360deg is equivalent to 0deg. Any color whose color-stop value is greater than 100% or 360deg won't be drawn on the conic gradient but it will still affect its color distribution.

The following image shows a conic gradient that starts with a yellow color and ends with orange.

It is hard not to notice the sharp transition that separates the orange at 360deg from the yellow at 0deg. Remember that conic gradients always produce this transition whenever the starting and ending colors of the conic gradient are very different. One way to avoid it is setting the starting and ending color to the same value.

Syntax for Conic Gradients

Continue reading %How to Create CSS Conic Gradients for Pie Charts and More%

Sass Functions to Kick-Start Your Style Sheets

SitePoint - Wed, 08/16/2017 - 14:00

Sass has a number of built-in functions to help you set up the styles for your project a lot quicker and easier.

Let's dive into a few of them!

The Darken and Lighten Sass Functions

Possibly two of the best-known functions in this list, I’m going to count these as one because they do the same thing, but in different directions.

As the names suggest, darken and lighten will darken and lighten a color by a certain percentage respectively. You could use them on a button's hover state or throughout a site to create hierarchy. Here's how:

[code language="sass"]
$main-color: #6dcff6;
$darker-color: darken($main-color, 20%);
$lighter-color: lighten($main-color, 20%);
[/code]

The second argument in these two functions takes a percentage value by which to darken/lighten a color. This way you don’t have to look up the hex for a slightly lighter color every time you want an easy interaction state. For example, you could do this:

[code language="sass"]
.brand-button {
background: $main-color;
}

.brand-button:hover {
background: $lighter-color;
}

.brand-button:visited {
background: $darker-color;
}
[/code]

Which compiles into this:

[code language="css"]
.brand-button {
background: #6dcff6;
}

.brand-button:hover {
background: #cdeffc;
}

.brand-button:visited {
background: #0fafee;
}
[/code]

Using these functions means that you could create an effective color palette that can remain consistent throughout your project. If, for instance, you have highlight and inactive state colors based off of a main brand color and your client decides to change their main color midway through development (it happens more than I care to admit…), you only have to change one value and see it cascade throughout the rest of a site.

The Opacify and Transparentize Sass Functions

Still sticking with colors, opacify and transparentize make colors more or less opaque respectively.

Continue reading %Sass Functions to Kick-Start Your Style Sheets%

Migrating from WordPress.Com to Self-Hosted WordPress

SitePoint - Wed, 08/16/2017 - 13:00

WordPress.com is a limited version of WordPress run by Automattic. Here, you can create a blog or website in moments without worrying about hosting and managing your WordPress. However, to use many more complex plugins and functionality, and to have the full breadth of customization you desire, you may at some point decide to use […]

Continue reading %Migrating from WordPress.Com to Self-Hosted WordPress%

Building a Multiplayer TicTacToe Game with Meteor

SitePoint - Tue, 08/15/2017 - 19:00

Meteor is a popular, full stack web framework that makes it very easy to prototype your ideas and get from development to production really fast. Its reactive nature and the use of DDP, make it a great candidate for building simple, multiplayer, browser games.

In this tutorial, I'll show you how to build a multiplayer TicTacToe with Meteor, using its default front-end templating engine, Blaze. I will assume that you have played around with Meteor a bit, and of course, that you feel comfortable coding with JavaScript.

If you have zero experience with Meteor I'd recommend you first follow the TODO app tutorial on the official Meteor site.

You can find the code for the completed app in the accompanying GitHub repo.

Creating the app

If you don't have Meteor installed you should follow the instructions on their site according to your OS.

Generate the Scaffolding

Now with Meteor installed, open your terminal and run the following command:

meteor create TicTacToe-Tutorial

This will create a folder with the name of your app (in this case TicTacToe-Tutorial). This new folder contains the basic file structure for an app. There's actually a sample app inside.

Navigate to the folder:

cd TicTacToe-Tutorial

And now run the app:

meteor

I know, I know... that's a terribly hard-to-remember command, and you'll be using it a lot, so you should start memorizing it!

If everything went fine now the console should be building the app. After it's done, open your web browser and go to http://localhost:3000 to see the app running. If you have never done so before, I'd recommend you play around with the sample app. Try to figure out how it works.

Let's take a look at the file structure. Open your app's folder. The only things there that we care about (for now) are the client folder and the server folder. The files inside the client folder will be downloaded and executed by the client. The files in the server folder will only be executed on the server and the client has no access to them.

These are the contents in your new folder:

client/main.js # a JavaScript entry point loaded on the client (we won't be needing this) client/main.html # an HTML file that defines view templates client/main.css # a CSS file to define your app's styles server/main.js # a JavaScript entry point loaded on the server package.json # a control file for installing NPM packages .meteor # internal Meteor files .gitignore # a control file for git Building the board

A TicTacToe board is a simple three by three table; nothing too fancy, which is great for our first multiplayer game, so we can focus on the functionality.

The board will be downloaded by the client, so we'll be editing files inside the client folder. let's begin by deleting the contents on main.html and replacing it with the following:

client/main.html

<head> <title>tic-tac-toe</title> </head> <body> <table id="board"> <tr> <td class="field"></td> <td class="field"></td> <td class="field"></td> </tr> <tr> <td class="field"></td> <td class="field"></td> <td class="field"></td> </tr> <tr> <td class="field"></td> <td class="field"></td> <td class="field"></td> </tr> </table> </body>

Don't forget to save your files after making changes! Otherwise, they won't be acknowledged by Meteor.

Now let's add some css to our board. Open the main.css file and add the following content:

client/main.css

table { margin: auto; font-family: arial; } .field { height: 200px; width: 200px; background-color: lightgrey; overflow: hidden; } #ui { text-align: center; } #play-btn { width: 100px; height: 50px; font-size: 25px; } .mark { text-align: center; font-size: 150px; overflow: hidden; padding: 0px; margin: 0px; } .selectableField { text-align: center; height: 200px; width: 200px; padding: 0px; margin: 0px; }

We've also added a few extra ids and classes that we'll be using later on in this tutorial.

Finally, delete client/main.js, as we won't be needing it, and open the app in the browser to see how it looks.

This is fine and all, but is not an optimal solution. Let's do some refactoring by introducing Blaze Templates.

Creating a Template

Templates are pieces of HTML code with their own functionality that you can reuse anywhere in your app. This is a great way to break up your apps into reusable components.

Before creating our first template, we'll add two more folders inside the client folder. We'll call one html and the other one js.

Inside the html folder, create a new board.html file with the following content:

client/html/board.html

<template name="board"> <table id="board"> <tr> <td class="field"></td> <td class="field"></td> <td class="field"></td> </tr> <tr> <td class="field"></td> <td class="field"></td> <td class="field"></td> </tr> <tr> <td class="field"></td> <td class="field"></td> <td class="field"></td> </tr> </table> </template>

Now, on the main.html folder replace the content inside the body tag with the following code:

client/main.html

<head> <title>tic-tac-toe</title> </head> <body> {{>board}} </body>

This will insert our template with the property name="board", inside the body tag.

But this is the same hard coded board that we had before. Only now, it's inside a template, so let's take advantage of the template helpers to build our board dynamically.

Using helpers

We'll declare a helper in the board template that will provide us with an array with the same length as the dimensions we want our board to have.

inside the js folder create a file called board.js with the following content:

client/js/board.js

import { Meteor } from 'meteor/meteor'; import { Template } from 'meteor/templating'; Template.board.helpers({ sideLength: () => { let side = new Array(3); side.fill(0); return side; } });

Now, we'll use this helper in the board's template HTML to repeat one single row for each element in the array provided by the helper. To help us with this, we'll use the Each-in Spacebars block helper.

Replace the content inside the board.html file with the following:

client/html/board.html

<template name="board"> <table id="board"> {{#each sideLength}} {{#let rowIndex=@index}} <tr> {{#each sideLength}} <td class="field" id="{{rowIndex}}{{@index}}"> {{{isMarked rowIndex @index}}} </td> {{/each}} </tr> {{/let}} {{/each}} </table> </template>

Notice that we're looping through the array twice, once for the rows and once for the columns, instantiating the corresponding tag (tr or td) as we go. We're also setting their id properties as the @index of the row + @index of the column. What we get is a two digits number that will help us identify that element, with its position on the board.

Check out the app at http://localhost:3000 to see how it's looking so far.

UI

Now that we have a good looking board, we'll need a play button and a tag to show information on the current game.

Let's begin by creating the ui.html file inside the html folder... you know the drill. Now, add the following content to it:

client/html/ui.html

<template name ="ui"> <div id="ui"> {{#if inGame}} <p id="status"> {{status}} </p> {{else}} <button id="play-btn">Play</button> {{/if}} </div> </template>

As you can see we're using the #if Spacebars block helper and the inGame helper (that we haven't yet defined) as a condition. There's the status helper inside the p tag too. We'll define that later also.

How does it work? #if the inGame helper returns true, the player will see whatever's in the status helper. Otherwise, we'll simply show the play button.

Don't forget, for this component to be displayed we need to add it to our main client template:

client/main.html

<head> <title>tic-tac-toe</title> </head> <body> {{>ui}} {{>board}} </body> Logging in

We won't be dealing with any login UI. We will install a very useful package called brettle:accounts-anonymous-auto that will automatically log in all users anonymously into our app.

Head over to your console and run the following command:

meteor add brettle:accounts-anonymous-auto

Now, when you open the app for the first time after adding this package, it'll create a new user, and every time you open the app on the same browser it'll remember you. If we're not keeping any data from said user, it might be better to just remove them when they log out. But we're not going over that in this tutorial.

Building the Game

Finally, we're going to start building the game itself! Let's go over the functionality we'll be implementing, to have a clear view of what's coming next.

We'll need functionality for:

Continue reading %Building a Multiplayer TicTacToe Game with Meteor%

How to Create Beautiful HTML & CSS Presentations with WebSlides

SitePoint - Tue, 08/15/2017 - 14:00

Presentations are one of the best ways to serve information to an audience. The format is short and sharp, made up of small, digestible chunks, which makes any topic under discussion engaging and easier to understand. A presentation can contain all kinds of data, represented by many different elements, such as tables, charts, diagrams, illustrations, images, videos, sounds, maps, lists, etc, all of which lends great flexibility to this medium of expression.

Particularly on the web, presentations come in handy on many occasions, and there are loads of tools at your disposal to create some nifty ones. Today, I'll introduce you to WebSlides — a small and compact library with a nice set of ready-to-use components, which you can leverage to build well-crafted and attractive web presentations:

WebSlides "is about telling the story, and sharing it in a beautiful way."

In fact, one of WebSlides' main benefits is that you can share your story beautifully and in a variety of different ways. With one and the same architecture — 40+ components with semantic classes, and clean and scalable code — you can create portfolios, landings, longforms, interviews, etc.

Besides, you can also extend WebSlides' functionality by combining it with third-party services and tools such as Unsplash, Animate.css, Animate On Scroll, and so on.

WebSlides is easy to learn and fun to use. Let's see it in action now.

Getting Started with WebSlides

To get started, first download WebSlides. Then, in the root folder, create a new folder and call it presentation. Inside the newly created presentation folder, create a new file and call it index.html. Now, enter the following code, which contains the needed references to the WebSlides' files (make sure the filepaths correspond to the folder structure in your setup):

[code language="html"]
<!doctype html>
<html>
<head>

<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Roboto:100,100i,300,300i,400,400i,700,700i%7CMaitree:200,300,400,600,700&subset=latin-ext" rel="stylesheet"/>
<!-- CSS Base -->
<link rel="stylesheet" type='text/css' media='all' href="../static/css/base.css"/>
<!-- CSS Colors -->
<link rel="stylesheet" type='text/css' media='all' href="../static/css/colors.css"/>
<!-- Optional - CSS SVG Icons (Font Awesome) -->
<link rel="stylesheet" type='text/css' media='all' href="../static/css/svg-icons.css"/>

<body>
<!-- PUT WEBSLIDES PRESENTATION CONTENT HERE -->

<script src="../static/js/webslides.js"></script>
<script>
window.ws = new WebSlides();
</script>

<!-- OPTIONAL - svg-icons.js (fontastic.me - Font Awesome as svg icons) -->
<script defer src="../static/js/svg-icons.js"></script>
</body>
[/code]

Now, you're ready to go.

Create a Web Presentation with WebSlides

In this section you're going to create a short, but complete presentation, which explains why SVG is the future of web graphics.
Note: If you are interested in SVG, please check my articles: SVG 101: What is SVG? and How to Optimize and Export SVGs in Adobe Illustrator.

You'll be working step by step on each slide. Let's get started with the first one.

Continue reading %How to Create Beautiful HTML & CSS Presentations with WebSlides%

PHPBot – Can a PHP Bot Help You Look up Documentation Faster?

SitePoint - Tue, 08/15/2017 - 12:00

I came across PHPBot the other day (not to be confused with Botman or Fondbot) - a "chatbot" which helps you look up PHP manual entries and generates example code for them.

If you follow me on Twitter, you know I don't believe in chatbots being chatbots - as someone who's built some for both commercial purposes and personal ones, and as someone who was around in the age of IRC auto-responding scripts, I see chatbots as a little more than a marketing fad designed to impress today's Snapchat generation. However, every now and then one will appear that's actually useful. Could this be the one? Let's take a look.

Concept

The idea is that you use the text input on the page to enter a PHP related term (like "ksort") and the application will reply with an explanation and some example code, like so:

ksort input" />

Different queries will produce different responses. So, if you ask it for echo:

echo" />

Continue reading %PHPBot – Can a PHP Bot Help You Look up Documentation Faster?%

Incredible Design Tools & Resources, August 2017

SitePoint - Tue, 08/15/2017 - 11:00

Keeping up to date with the latest design tools, resources, apps, books and trends is tough, and sieving through the things that are relevant, useful and interesting to us is even tougher. Which is why we've started a Product Hunt collection showcasing the absolute best design tools and resources that we've discovered, some of which we use here at SitePoint!

Follow the collection on Product Hunt to receive a notification when we (editors Alex Walker, and myself, Daniel Schwarz) add something to the collection that you really, really must check out. Plus, we'll personally handpick the best of the best to talk about in a monthly article, like we're doing right now! Welcome to Best Design Products: August Edition!

Rage Grade by FullStory
  • Summary: benchmark your customer frustration

Rage Grade by FullStory uses machine learning to detect negative signals in the customer experience as they use your app or website, and awards the overall experience a grade between -C and A. It also brings the top ten key moments of frustration to your attention, and lets you rewind the session to the exact moment of rage. It'll detect signals such as error clicks, mouse thrashing and form abandonment, and even benchmark the customer experience against industry competition.

FullStory doesn't tell you what you want to hear, it tells you the full story (sorry, I had to!).

Link: https://www.producthunt.com/posts/rage-grade-by-fullstory

Figma 2.0
  • Summary: design tool for handoff and prototyping

Figma has been boldly leading the charge in the realtime-multiplayer design collaboration space, allowing multiple designers to work on the same design file at the same time, and it works on macOS, Windows and in the browser.

Version 2.0 makes Figma a triple-threat, as it now offers prototyping and design handoff features alongside the standard design tools we've come to love. We even use it at SitePoint! Design handoff can be used in a "view only" mode so that developers don't accidentally mess up design files, and they don't need to be a paying team member either. Win win!

Link: https://www.producthunt.com/posts/figma-2-0

Gravity Sketch VR
  • Summary: bring VR into your design workflow

Prepare yourselves, this stuff is…well…there are no words, really. Gravity Sketch is an immersive 3D design tool for creating models, scenes and other 3D objects using virtual reality headgear like the Oculus Rift. Gravity Sketch VR co-founder Daniela Paredes claims that you can totally spend 8 hours sketching 3D objects in the virtual reality world.

You really have to see the video to appreciate its beauty.

Link: https://www.producthunt.com/posts/gravity-sketch-vr

Freehand 2.0 by InVision App
  • Summary: collaborative, freehand sketching and wireframing

InVision App have been adding some really amazing new features to their Craft Sketch Plugin recently (Craft Stock, Craft Prototype, etc), but one that's really stood out for designers has been Craft Freehand, now on its 2nd version. Freehand works in the core InVision App (as well as in Sketch) and is accessible to collaborators of all types (designers and stakeholders) on a multitude of devices, allowing them to collaborate in realtime on rough digital sketches in a way that's both fun and easy.

Sketch alongside your high-fidelity mockups, or start from scratch and iterate fresh concepts with your team.

Multiple cursors + unlimited canvas + unlimited creativity = win.

Link: https://www.producthunt.com/posts/freehand-2-0-from-invision

Chain
  • Summary: create dynamic colour relations in Sketch

Inspired by SASS functions, chain allows designers to create dynamic colour relations in Sketch. For example, you could reduce the saturation of [x] amount of layers by 80% all at once, even if all of those layers were a different colour.

Link: https://www.producthunt.com/posts/chain-4

Smartmockups 2.0
  • Summary: create stunning mockups without using Photoshop

Mockups were very trendy at one stage, although really they should have been called product screenshots as "mockup" is already a design term. Traditionally, we used Photoshop to insert our website/app screenshot into a real image of an actual device using Smart Objects, but now that a multitude of design tools are now becoming mainstream, Photoshop is becoming much less trendy as a design tool for user interface design. So…how do we create these mockups now?

Smartmockups. Version 2 delivers us GIF functionality, so we can now create animated mockups using the latest device previews, and there's also a bunch of new options that allow for better tweaking of the final output (cropping, zooming, etc).

Link: https://www.producthunt.com/posts/smartmockups-app-2-0

Keys for Sketch
  • Summary: advanced keyboard shortcut manager for Sketch

Not every feature in Sketch has a shortcut. Granted, these are usually less-common features, but it's still annoying when you have to scurry through the menu bar to find certain things. Plus, not all keyboard shortcuts are intuitive, and some may conflict with Sketch Plugins. Designers coming over from Photoshop may also want to reassign keyboard shortcuts.

Enter Keys For Sketch.

Link: https://www.producthunt.com/posts/keys-for-sketch

Continue reading %Incredible Design Tools & Resources, August 2017%

Introducing Website Speed Test: An Image Analysis Tool

SitePoint - Fri, 06/30/2017 - 13:35

This article was sponsored by Cloudinary. Thank you for supporting the partners who make SitePoint possible.

Because images dominate page weight, methodical image optimization can have a significant effect on conversions and user experience. The performance tools you choose to use can have a powerful impact on how websites are built and maintained. One such popular open source tool is WebPagetest. It is designed to measure and analyze webpage performance, which is why Cloudinary chose to partner with our friends there to launch Website Speed Test.

Website Speed Test is an image analysis tool that provides detailed optimization insights beyond a simple compression check. The tool leverages Cloudinary’s advanced algorithms to demonstrate how changes to image size, format, quality and encoding parameters can result in significant reductions in file size while maintaining perceived quality. In short, Website Speed Test shows the why and how of image optimization.

How Website Speed Test Works

Advanced algorithms take into account many factors when examining images, including the exact content of an image and the need for responsive design. The resulting insights enable you to ensure that images are encoded correctly, optimized for performance, and look their best regardless of bandwidth, viewing browser, device or viewport.

At the top of the page, the report shows the total weight of images, potential compression and ‘Page Image Score’: a grade ranging from A-F. This grade is based on the image format used, fit between image resolution and the displayed size in the graphic design, and compression rate of all the images that were analyzed.

The overview is followed by a detailed analysis of each image, with performance insights and recommendations for improvement.

Left Tab – Current Image

Presents the current version of the image being analyzed along with its image score.

Middle Tab – Optimized Image

Presents an optimized version of the image, using the same format as the original image, with the following adjustments:

  • Correctly-sized images - scales the image down to the actual required dimensions on the web page
  • Intelligent content-aware encoding - analyzes the image to find the best quality compression level and optimal encoding settings, based on the content and viewing browser, producing a perceptually fine image while minimizing the file size.

Learn more about these manipulations

Right Tab - Format Alternatives

This tab shows how optimization works for different image formats and the impact on image weight.

Improved Image Analysis Using WebPagetest

Linked from a new Image Analysis tab, Cloudinary powers WebPagetest with robust image analysis capabilities, enabling you to receive valuable data and guidance on how to manage images and deliver an optimal user experience.

Optimizing Images is No Easy Task

The Website Speed Test tool provides insights on the why and how of optimization. While you may be able to optimize an image or two manually, the process becomes exponentially more complicated when you need to scale up, managing hundreds, thousands, or even millions of images delivered to a website.

For the best user experience, each image should be enhanced and optimized to meet the viewing context. This entails automatically adapting the image to fit the layout of the page and selecting the optimal quality and encoding settings.

Accomplishing this type of optimization is no ordinary feat. Optimizing images for different browsers, devices and bandwidth requires considerable knowledge of the intricacies of image formats, encoding parameters and visual quality metrics. For example, it makes sense that a smaller image file size will result in faster load time, less bandwidth usage and a better user experience. However, reduce the file size too much, and image quality could suffer and impair user satisfaction. This is where Cloudinary’s automatic optimization comes in play.

You can create your free account here.

Continue reading %Introducing Website Speed Test: An Image Analysis Tool%

8 Must Have PHP Quality Assurance Tools

SitePoint - Fri, 06/30/2017 - 08:00

For shipping quality code, we must have testing in mind while coding (if not doing TDD). However, with the wide range of PHP testing tools out there, it's hard to make a choice! Exploring PHP is a fun adventure (premium course on that here!) but it's hard to assemble a toolbelt that's not too heavy to wear to work!

This popular article will highlight the most popular testing tools and has been updated to reflect the state of QA tools in 2017.

Untested code is broken code.

PHPUnit

PHPUnit is the go to testing framework for PHP. It was created by Sebastian Bergmann in 2004 and current in version 6 that requires PHP 7.

We have plenty of tutorials coming up about it, but here are some you can already consume.

Cucumber

Cucumber is a framework for creating acceptance tests from specifications. It's known for it descriptive generated texts that can be read as just plain English. The official PHP implementation for Cucumber is Behat.

We have a getting started tutorial about it here on SitePoint. The below example taken from the documentation is a good example on how expressive those expectations are.

Feature: Listing command In order to change the structure of the folder I am currently in As a UNIX user I need to be able see the currently available files and folders there Scenario: Listing two files in a directory Given I am in a directory "test" And I have a file named "foo" And I have a file named "bar" When I run "ls" Then I should get: """ bar foo """ Atoum

Atoum is another unit testing framework for PHP. It's a standalone package that you can install via GitHub, Composer or via a PHAR executable file.

Atoum tests are very readable with expressive method names and chaining.

$this->integer($classInstance->myMethod()) ->isEqualTo(10); $this->string($classInstance->myMethod()) ->contains("Something heppened");

You want to learn more about PHP unit testing with Atoum, you can follow this tutorial.

Selenium

Selenium is a tool for automated browser testing (Integration and acceptance testing). It transforms the tests to browser API commands and it asserts the expected results. It supports most of the available browsers out there.

We can use Selenium with PHPUnit using an extension.

composer require --dev phpunit/phpunit composer require --dev phpunit/phpunit-selenium

Here's a simple example:

Continue reading %8 Must Have PHP Quality Assurance Tools%

Back to Basics: What are Callbacks in JavaScript?

SitePoint - Thu, 06/29/2017 - 16:00

When learning JavaScript, it doesn't take long until you encounter callbacks. These might seem strange and mysterious to beginners, yet it is very important to understand how they work in order to harness the power of the language. In this article I will teach you the basics of callbacks using easy-to-understand examples.

Callbacks — image via unsplash

What Is a Callback?

Simply put: A callback is a function that is to be executed after another function (normally asynchronous) has finished executing — hence the name ‘call back’.

More complexly put: In JavaScript, functions are objects. Because of this, functions can take functions as arguments, and can be returned by other functions. Functions that do this are called higher-order functions. Any function that is passed as an argument and subsequently called by the function that receives it, is called a callback function.

That’s a lot of words. Lets look at some examples to break this down a little more.

This article was first published on codeburst.io and is republished here with the author's permission. If you enjoy reading, why not head over there and check out some of Brandon's other articles? If you'd like to sharpen your JavaScript skills in general, why not head over to SitePoint Premium and sign up for our Introduction to JavaScript course.

Why Do We Need Callbacks?

For one very important reason — JavaScript is an event driven language. This means that instead of waiting for a response before moving on, JavaScript will keep executing while listening for other events. Lets look at a basic example:

function first(){ console.log(1); } function second(){ console.log(2); } first(); second();

As you would expect, the function first is executed first, and the function second is executed second — logging the following to the console:

// 1 // 2

All good so far.

But what if function first contains some sort of code that can’t be executed immediately? For example, an API request where we have to send the request then wait for a response? To simulate this action, were going to use setTimeout which is a native JavaScript method that calls a function after a specified delay. We’ll delay our function for 500 milliseconds to simulate an API request. Our new code will look like this:

Continue reading %Back to Basics: What are Callbacks in JavaScript?%

​Easily Set Up, Manage, and Protect Your Apple Devices with Jamf Now

SitePoint - Thu, 06/29/2017 - 13:30

This article was sponsored by Jamf Now. Thank you for supporting the partners who make SitePoint possible.

Employees have never been more mobile, increasing the demand for connected smart devices. Between visiting customers, working from home, being embedded with clients, or simply working on the go, connectivity and security is vital to the health and bottom line of all businesses.

Apple devices are incredibly popular in the modern workplace — their combination of beautiful aesthetics, powerful brand recognition, ease-of-use, and a rich application ecosystem makes them a natural choice. The ubiquity of these devices does come with a challenge though — how do you set up, manage, and protect your Mac and iOS devices, no matter where they are or how they’re used?

There’s a software solution that’s up to that challenge — Jamf Now.

Jamf Now — Mobile Device Management

Jamf Now is beautiful, fully-featured, easy-to-use, mobile device management solution designed to make managing iPhone, iPad, and Mac devices a pleasure, throughout your business.

Jamf Now mobile device management provides three key features:

Set Up Devices

Provide consistent configuration settings across all devices to minimize user effort and give employees the exact settings, accounts, and applications needed to work at maximum productivity.

Manage Devices

Collect device information for inventory visibility, manage data usage, and update or deploy applications directly to devices so users always have access to the latest, most functional, and secure versions.

Protect Devices

Ensure that sensitive company information and data accessed on an Apple device remains secure. This includes encryption and enforcing security on devices including passcodes, locking, and even remotely wiping devices.

The Business Benefits of Jamf Now

Jamf Now provides several benefits to your business:

  • Reduces time and resources spent on setting up and managing Apple devices.
  • Ensures consistent application and device settings that can be customized by role or need.
  • Allows rapid deployment of applications for additional functionality or enhanced security.
  • Provides better license and asset management across all devices.
  • Enforces data encryption and passcode access to protect information.
  • Wipes data if a device is lost or falls into the wrong hands.

Jamf Now is Designed Around Simplicity

Traditionally, device management has been the responsibility of the IT department. Jamf Now removes the complexity of managing devices through a simple, easy-to-use interface that lets anyone set up configuration, security rules, application details, and more. The philosophy behind Jamf Now is to get employees set up and using their devices as quickly as possible. The Jamf Now software runs in the background so it’s never a distraction to the user, meaning they can get on with their work in a safe, secure, and always updated environment.

Jamf Now Works with Apple / iOS Devices, Across Multiple Industries

Jamf Now works with Mac, iPad, iPhone, and iPod devices across your business.

Jamf Now works with Apple devices in any industry — from education to finance, retail, manufacturing, healthcare, field services, and more.

Jamf Now Device Setup

Jamf Now takes the hassle out of setting up devices by letting you create a “blueprint.” This lets you input settings once and quickly send them to every device. You can easily customize individual devices with areas like email addresses, role-specific apps, data access, and more. Jamf Now supports Microsoft Exchange, Google Mail, Yahoo! Mail, and any IMAP or POP mail accounts.

Every employee gets access to the right settings, accounts, applications, and data they need to do their job and contribute to your bottom line.

Jamf Now Device Management

It’s vital that employees have access to the latest versions of applications, whether that’s because they need greater functionality or as the result of patching security vulnerabilities. Jamf Now’s management features makes it a breeze to push out new versions of apps. Just point Jamf Now at the latest version and it will automatically download and install it on every user’s device, in the background.

This can significantly reduce the workload of your IT department as it removes the need for manual installs. It also ensures everyone is on the latest version of an app, making support and troubleshooting quicker, easier, and more effective. License management is more effective, letting you track assets and licenses to ensure you don’t pay for software you don’t use. Jamf Now integrates with Apple’s Volume Purchasing Program, letting you buy and deploy multiple licenses and apps to devices, quickly and easily.

Jamf Now also makes inventory and asset management easier — you can easily export details of every device for compliance checks and get insight into all the key information for every device.

Jamf Now Device Security

Mobile devices, especially iPhones and iPads, are easily forgotten and can be prime targets for theft. Jamf Now helps to protect your devices and company data from getting into the wrong hands. It does this in several ways:

  • Encrypting data and information on the device.
  • Enforcing a passcode on the device.
  • Allowing you to remotely lock the screen.
  • Allowing you to display messages on the lock screen (e.g. asking for the device to be returned).
  • Allowing you to remotely wipe all sensitive data from the devices.
  • Allowing you to see the physical location of the phone, through GPS.

Jamf Now is Cloud-Based

Jamf Now runs on a “software as a service” model. It’s cloud-based, so you can manage your Apple devices from anywhere with an internet connection.

Jamf Now Pricing

One of the most attractive features of Jamf Now is the pricing. You can manage your first three devices at no charge. After that, it’s just $2 per device, per month.

Jamf Now Support

Jamf Now is fully supported in three main ways:

  • Live chat with customer service representatives and technical teams.
  • Email support for issues and problems.
  • A complete knowledge base covering all aspects of the software.

The knowledge base contains information on deployment, setup, enrolling devices, configuration, blueprints, devices, apps, settings, troubleshooting, and more.

If your business uses Apple devices, Jamf Now can give you the peace-of-mind you need. Its combination of smart setup, effortless device management, and enhanced security features will empower your users, protect your data, and help you manage all your Apple devices.

Continue reading %​Easily Set Up, Manage, and Protect Your Apple Devices with Jamf Now%

Subscribe to Kariann Wolf Morris aggregator - Web Design &amp;amp; Development
KARIANN WOLF MORRIS
46 Old Stage Road
Ballston Lake NY 12019
p | 518.857.3359