Tuesday, January 10, 2017

5 Ways to Delight with UX Details Combining GIFs and CSS

User Experience is not only about Usability but also about making your product or website pleasant to use and even delightful. One way you can create a delightful experience on your site is to create meaningful transitions, interactive or visual elements that match the look and feel of your site, and one way to accomplish this is combining GIF’s and CSS.

With a number of examples below you can consider how you might use GIF’s and CSS in a modern and stylish way – not to distract or even impress, but just to create better experiences. GIF’s aren’t just for cats and spamming your coworkers on slack anymore.

Here are 5 example utilizing GIFs and CSS in web design that might help you delight the visitors to the sites you design and develop:

1. Making a GIF play on rollover

Whether it’s icons displaying your differentiating features or an icon you want communicate meaning to your site visitor – one pleasant and fairly simple way to do this is with GIFs and CSS. You can have a static starting version of the GIF as the background, and then when someone rolls over the area, swap it out with the animated GIF version.

[code language="html"]
<div class="play-GIF-on-hover"></div>
[/code]

[code language="css"]
.play-GIF-on-hover {
width: 200px;
height: 200px;
background-image: url('path-to-your-folder/this-is-the-static-version.GIF');
background-size: 100%;
background-position: center center;
}
.play-GIF-on-hover:hover {
background-image: url('path-to-your-folder/this-is-the-animated-version.GIF');
}
[/code]

2. Using them as a GIF Preloader

If you’ve never created the CSS for a preloading overlay before, you will need to create the HTML and the CSS that constitutes the overlay screen first. You can then position your own custom pre-loader GIF over the top of it. If you don’t have a preloader GIF queued up, Codrops has a very nice set of them you can check out here (examples below.)

Preloaders

If you need more information on how to make solid GIFs check out “7 Tips For Designing Awesome Animated GIFs

3. Create an animated menu

Giphy Navigation

Giphy recently replaced their menu, but this previous version of it was brilliant (and topical!) Giphy’s menu plays a GIF on Roll over and gives you an idea of the kind of content you would see behind door number one, two, three and so on. The trick here is to keep things fairly subtle and not too ‘in your face’ lest you make it feel a bit cheap.

4. As a background like HeadSpace

Once again, subtlety is key here. Instead of going for a really in your face set of movements within the GIF – they only have a couple indication of live action. This allows the viewer to not notice, and then discover that something is moving in the background, perhaps pleasantly surprising them on closer inspection.

Technically, this is a nice example of what is known as a GIF ‘cinemagraph’ and weighs in at a respectable 1MB. However, if you want to get much fancier with the animation, this may be a better job for a video background (30-40 second tops) that loops.

Gif Animation

This is what that background looks like in context – as a sort of billboard/hero section, and of course using – background: cover with CSS keep its dimensions fitting in the space.

Headscape

5. Hover states on your buttons

Now, because there are no hover states on mobile sites, that limits the applications here. You might want to use this on a site where you can incorporate a more subtle GIF with a light looping pattern that’s moving softly, to increase the interactive feeling without it looking cheesy.

Just because something is not available to use on mobile, doesn’t mean you totally forget ways to progressively enhance on desktop, without making it something crucial to navigation or overall functionality.

Button

Code snippet, originally here.

GIFs aren’t just for decoration

As with any design detail, it’s important to not get wrapped up in adding frills just for the sake of our own creative indulgence. Whenever I add a feature utilizing GIFs and CSS, I want to make sure that I’m doing it to improve communication. The hover state above indicates some type of meaning, helping a visitor know they are indeed hovering over a button – and it might even make them curious what will happen when they take the next step.

[author_more]

[/author_more]

Every detail we add to a design should help communicate meaning and lead the visitor down the path we'd like them to take – or at least make it easier and more enjoyable to get where they want to go.

Continue reading %5 Ways to Delight with UX Details Combining GIFs and CSS%


by Tim Brown via SitePoint

Towards a Manifesto for Making Meaningful Work

How can we create more meaning in our everyday work?

How can we make routines to contribute to the intention of wellness for people, work, projects, communities and economies for an enlightened future society? Try following these practice cards, for a start.

1. Positivity – create flow instead of a negative first approach

“Businesses are often conservative by nature and avoid taking risks. But the world needs big thinkers and big dreamers—people who are willing to look beyond the day-to-day operations and current constraints and look for ways to inspire.”

Practice: List 5 positives in a situation to discuss with others.

2. Listening and learning – actively listen first and be present before sharing your opinions

“Forming a relationship with a person means viewing that person as an equal: a human being who can contribute actively to these conversations.”

Practice: Listen before speaking to better understand the other person first and remember that you have two ears to practice with.

3. Biases – be explicitly aware of your own biases

“In identifying assumptions, a team takes a pause from their work to reflect on the evidence they’ve gathered, the approaches they’ve taken, the experiments the project has generated, and the team’s own reasoning to identify their biases and open their minds to external criticism.”

Practice: List 5 assumption or fears to challenge and discuss with others.

4. Define the problem – understand the problem to be solved before proposing solutions

“In defining our intentions, team members take the time to interact with one another and their stakeholders and share existing knowledge. They develop a plan and agree upon a project’s focus, exploring how it will determine the quality of project outcomes.”

Practice: List out 5 attributes of a problem and then list out a contributor to each attribute.

5. Magic in the nuance – deconstruct extreme statements and look for the useful nuances

“When sharing observations, a team comes together to read stories about people’s behavior and record them in the team’s collective memory. This routine enables a team to identify surprising or deeply memorable situations that deserve further analysis by the whole team.”

Practice: Take an extreme statement and list 5 questions you would like answers to.

6. Commonalities before differences – find common connections between people, roles and teams

“When people experience positive emotions, there may be opportunities to bridge them quickly to another positive moment and link up to this goodness through design. If people experience negative emotions, there may be opportunities to devise techniques to address them. We need to be able to assess people’s feelings, from moment to moment, and to understand the approaches that get the best from the people around us.”

Practice: Introduce yourself to a person in another team and learn more about what their job entails.

7. Continuous life learning – seek out incremental improvement instead of massive change

“To that end, we need to get out of our cubicles, get out of the building, and learn how our products and services fit into real people’s lives. To communicate our understanding of human needs, we need to capture rich stories in the voice of the customer, as well as photos and videos. We must encourage businesses to foster constant curiosity about how they can serve people better.”

Practice: Read 1 article per week and share what you’ve learned with others.

 

This article was originally published for UXmas – an advent calendar for UX folk. Catch up on all 24 posts at uxmas.com.

The post Towards a Manifesto for Making Meaningful Work appeared first on UX Mastery.


by Dan Szuc and Josephine Wong via UX Mastery

10 Tips to Become a Better Node Developer in 2017

I started working with Node full-time in 2012 when I joined Storify. Since then, I have never looked back or felt that I missed Python, Ruby, Java or PHP — languages with which I had worked during my previous decade of web development.

Storify was an interesting job for me, because unlike many other companies, Storify ran (and maybe still does) everything on JavaScript. You see, most companies, especially large ones such as PayPal, Walmart, or Capital One, only use Node for certain parts of their stack. Usually they use it as an API gateway or an orchestration layer. That's great. But for a software engineer, nothing compares with full immersion into a Node environment.

In this post I'll outline ten tips to help you become a better Node developer in 2017. These tips come from me, who saw and learned them in the trenches, as well as people who have written the most popular Node and npm modules. Here's what we'll be covering:

  1. Avoid complexity — Organize your code into the smallest chunks possible until they look too small and then make them even smaller.
  2. Use asynchronous code — Avoid synchronous code like the plague.
  3. Avoid blocking require — Put ALL your require statements at the top of the file because they are synchronous and will block the execution.
  4. Know that require is cached — This could be a feature or a bug in your code.
  5. Always check for errors — Errors are not footballs. Never throw errors and never skip the error check.
  6. Use try...catch only in sync codetry...catch is useless for async code, plus V8 can't optimize code in try...catch as well as plain code.
  7. Return callbacks or use if ... else — Just to be sure, return a callback to prevent execution from continuing.
  8. Listen to the error events — Almost all Node classes/objects extend the event emitter (observer pattern) and emit the error event. Be sure to listen to that.
  9. Know your npm — Install modules with -S or -D instead of --save or --save-dev
  10. Use exact versions in package.json: npm stupidly adds a caret by default when you use -S, so get rid of them manually to lock the versions. Never trust semver in your apps, but do so in open-source modules.
  11. Bonus — Use different dependencies. Put things your project needs only in development in devDependencies and then use npm i --production. The more un-required dependencies you have, the greater the risk of vulnerability.

So let's bisect and take a look at each one of them individually. Shall we?

Avoid Complexity

Take a look at some of the modules written by Isaac Z. Schlueter, the creator of npm. For example, use-strict enforces JavaScript strict mode for modules, and it's just three lines of code:

var module = require('module')
module.wrapper[0] += '"use strict";'
Object.freeze(module.wrap)

So why avoid complexity? A famous phrase which originated in the US Navy according to one of the legends proclaims: KEEP IT SIMPLE STUPID (or is it "Keep it simple, stupid"?). That's for a reason. The human brain can hold only five to seven items in its working memory at any one time. This is just a fact.

By keeping your code modularized into smaller parts, you and other developers can understand and reason about it better. You can also test it better. Consider this example,

app.use(function(req, res, next) {
  if (req.session.admin === true) return next()
  else return next(new Error('Not authorized'))
}, function(req, res, next) {
  req.db = db
  next()
})

Or this code:

const auth = require('./middleware/auth.js')
const db = require('./middleware/db.js')(db)

app.use(auth, db)

I'm sure most of you will prefer the second example, especially when the names are self-explanatory. Of course, when you write the code you might think that you understand how it works. Maybe you even want to show off how smart you are by chaining several methods together in one line. Please, code for the dumber version of you. Code for the you who hasn't looked at this code for six months, or a tried or drunk version of you. If you write code at the peak of your mental capacity, then it will be harder for you to understand it later, not to even mention your colleagues who are not even familiar with the intricacies of the algorithm. Keeping things simple is especially true for Node which uses the asynchronous way.

And yes, there was the left-pad incident but that only affected projects dependent on the public registry and the replacement was published in 11 minutes. The benefits of going small far outweigh the downsides. Also, npm has changed its unpublish policy, and any serious project should be using a caching strategy or a private registry (as a temporary solution).

Use Asynchronous Code

Synchronous code does have a (small) place in Node. It's mostly for writing CLI commands or other scripts not related to web apps. Node developers mostly build web apps, hence they use async code to avoid blocking threads.

For example, this might be okay if we are just building a database script, and not a system to handle parallel/concurrent tasks:

let data = fs.readFileSync('./acconts.json')
db.collection('accounts').insert(data, (results))=>{
  fs.writeFileSync('./accountIDs.json', results, ()=>{process.exit(1)})
})

But this would be better when building a web app:

app.use('/seed/:name', (req, res) => {
  let data = fs.readFile(`./${req.params.name}.json`, ()=>{
    db.collection(req.params.name).insert(data, (results))=>{
      fs.writeFile(`./${req.params.name}IDs.json`, results, ()={res.status(201).send()})
    })
  })
})

The difference is whether you are writing concurrent (typically long running) or non-concurrent (short running) systems. As a rule of thumb, always write async code in Node.

Continue reading %10 Tips to Become a Better Node Developer in 2017%


by Azat Mardan via SitePoint

Instagram, Snapchat, Facebook Twitter, Pinterest — 2016 #SocialMedia Highlights (Infographic)

2016 was jam-packed with social media news and tech developments. From the launch of Snapchat Memories to the Live 360 Facebook Videos, there was plenty to talk (and blog!) about. Here's an infographic-timeline, prepared by Adaptly, that scratches the surface of many social media happenings...

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

by Irfan Ahmad via Digital Information World

Build Your Own Atom Theme with CSS

Two scientists assessing a giant Atom logo in the lab

Atom describes itself as a "hackable text editor for the 21st century". It has become the go-to text editor for thousands of developers all over the world and is very easy to extend and customize. Developers share new features with the Atom community by publishing packages and themes. After reading this article, you can publish your own Atom syntax theme - a great first step in hacking Atom!

What is a Syntax Theme?

A syntax theme lets you style the text/code area in the editor. An interface theme, on the other hand, allows you to style all other aspects of the Atom text editor (like the sidebar, status bar, tabs and so on). We'll restrict ourselves to writing a syntax theme. This article only assumes a working knowledge of CSS.

Getting Started

So what do you need to get started? You just need to download the Atom text editor, and you're good to go! Atom uses Less, which is a superset of CSS with some nifty features like variables which we'll learn as we go along.

Generate an Atom syntax theme package

There was a time when writing a syntax theme meant a lot of work. Today, there's an excellent auto-generate feature built right into Atom.

  • Open Atom and hit Cmd + Shift + P (for Windows use Ctrl + Shift + P)
  • Type generate
  • Choose the Package Generator: Generate syntax theme option

Atom will prompt you for a location to save the package. You can save it anywhere you like.

Name your package

Atom will open up the generated package as a project that you can start editing. Atom recommends that the package name ends with -syntax, and it's best practice to use a lower case hyphen separated name. I'm going to name my package blue-everywhere-syntax and well, turn up the blue.

Package structure

The auto-generated package has been laid out carefully so that it is very easy to edit.

  • The main stylesheet resides in index.less.
  • The base styles reside in styles/base.less, and the colors reside in styles/colors.less. We'll dig deeper into these files soon.
  • If you've used Node.js and NPM then package.json will be familiar. It gives the package a name and description and lets you provide some useful metadata.
  • The README.md file allows you to describe your theme using markdown. If you publish your theme, this README will be visible to users who visit your download page.

Show Me The Code

So let's dive right in. Without getting into the details, it's useful to know that Atom's rendering engine is basically Chrome under the hood (check out Electron if you want to understand how it all works). That's why we can style it using good old CSS. But since the folks who built Atom wanted to make use of some convenient features like variables and nested imports, they chose to use Less. Not to worry, because we only need a couple of Less features and I've laid them out for you in the article!

Since Atom uses Chromium, all you need to do to see your changes reflect in your editor is, you guessed it, reload! You can reload Atom using Cmd + Alt + Ctrl + L or View > Developer > Reload. Let's go to Atom Settings (Cmd + ,) > Themes and set our editor's syntax theme to the new theme that we just created.

Let's turn things blue

Open the colors.less file (style > colors.less). You can see a variable called @very-dark-gray, whose value is set to #1d1f21.

[caption id="attachment_146632" align="aligncenter" width="1000"]The initial theme colors.less file Our initial theme colors.less file[/caption]

Let's change this to a dark blue instead #1d1f33. Now reload atom (Cmd + Alt + Ctrl + L or View > Developer > Reload). Boom! The background of the text area should have changed.

[caption id="attachment_146631" align="aligncenter" width="1000"]The theme colors.less file after the change Our theme colors.less file after the change[/caption]

What just happened?

Let's take a deeper look at these less files. index.less imports base.less. If we open up base.less, we see that it's quite similar to CSS. We can see that the theme is using some Less features like variables. Variables are easy to spot, since they begin with an @ symbol.

For now, let's focus on the editor's background color. The color is defined in the first few lines.

[code language="css"]
@import "syntax-variables";

atom-text-editor, :host {
background-color: @syntax-background-color;
[/code]

We can see that the editor's background-color is set to the variable @syntax-background-color. But where is @syntax-background-color defined?

We can see that a file called syntax-variables has been imported in the first line. Let's look inside syntax-variables.less for @syntax-background-color's definition.

[code language="css"]
@import "colors";

// This defines all syntax variables that syntax themes must implement when they
// include a syntax-variables.less file.

// General colors
@syntax-text-color: @very-light-gray;
@syntax-cursor-color: white;
@syntax-selection-color: lighten(@dark-gray, 10%);
@syntax-background-color: @very-dark-gray;
[/code]

We find that @syntax-background-color is set to @very-dark-gray. As you might've guessed, @very-dark-gray is defined in colors.less. This is why we opened up colors.less and changed @very-dark-gray to change the editor's background color.

Organization of stylesheets

How you organize variables between stylesheets is a matter of taste. Atom is suggesting through it's auto-generated template that you group together items which ought to have the same colors using syntax variables in base.less and then assign a color to each of these variables in syntax-variables.less. But you can see that this is more for our convenience, and in many cases, colors are also directly defined in base.less. Armed with this information, it should be fairly easy to change up the colors in your new theme! Experiment with an entirely new palette and view the results by reloading your Atom window.

Advanced Styling

But what if we want to change the styling for very specific cases? Apart from variables and imports, there are a couple of other Less features that we will find useful in reading and modifying our stylesheets. You can skip the next two subsections if you're already comfortable with using Less.

Continue reading %Build Your Own Atom Theme with CSS%


by Sanjay Guruprasad via SitePoint

PhoneGap Apps with Vue.js? Yes please

vue-logo

Vue.js

You’ve probably heard some buzz lately around Vue.js as one of the frameworks to check out in 2017. Vue.js has actually been around since 2014, but seems to be growing in popularity since Vue 2.0 was released last year. The Vue GitHub page has an impressive number of stars and describes Vue.js overall as:

A progressive, incrementally-adoptable JavaScript framework for building UI on the web.

Features

At its core, Vue.js is classified as a reactive, component-oriented view layer that is easy to integrate with other libraries and existing projects that can also scale in combination with supporting libraries to power sophisticated Single Page Applications. For instance there’s an official router, state management system (Flux/Redux type library), AJAX helpers, pre-built UI components, form validation and numerous other helper libraries you can take advantage of, making it “incrementally adoptable” overall. Another core feature to note is the reactive two-way data binding system which ensures your data and the DOM are always in sync.

What makes this framework an interesting choice to look at for mobile in particular is the minimal size (17kb for the core runtime and only 26kb for the runtime+vue-router+vuex), as well as the fact that the rendering layer was rewritten using a lightweight Virtual DOM implementation in Vue 2.0, greatly increasing performance. There are some interesting points and metrics regarding performance in comparison to some other popular frameworks in this post by the author, Evan You you may want to check out as well.

You can start learning Vue.js by using their guides here and JSFiddle sample app. There’s also a vue-cli available to help you scaffold your projects quickly. If you’d like to read more about how Vue.js compares with other frameworks in general, check out this guide posted on that topic specifically.

Mobile UI Frameworks + Vue.js

f7-logo

Framework7

Framework7 is an open-source UI framework for building hybrid apps that provides a heap of UI components, view navigation and other useful widgets to help you build mobile apps quickly. It also has support for both iOS and Android Material design. Take a moment to check out this overview post I wrote over on the PhoneGap blog to get a quick rundown of what it has to offer. I also recommend trying out their Kitchen Sink demo to see all of the components that come out of the box.

Vue Support

Recently Framework7 released a Framework-Vue plugin with support for pretty much all of the components and elements Framework7 supports, as well as integration of the Framework7 Router to render pages in the “Vue” way. This makes it super easy to take advantage of the best of both of these frameworks when building your mobile apps. If you were already using Framework7, you may also want to know there are some extra benefits to using this Framework7-Vue plugin in terms of more structured content, automatic data-binding and simplified layout differences for iOS and Material themes.

Along with their new support for Vue is a set of accompanying guides and sample templates you can use to get started developing quickly. The templates include a static version, a Webpack version and a Browserify version (the second two also with support for hot reload). Timo Ernst is a frequent Framework7 blogger that also posted a sample template and associated video on getting started with Framework7, Vue.js and Webpack that you should also check out.

Live Sample

Below is a live version of the Framework7+Vue Static Template to try out:

PhoneGap+Framework7+Vue Template

In an effort to make things easier to try out this new support immediately with PhoneGap, I decided to take the Framework7+Vue static template from above and add some necessary parts to it (cordova.js, deviceready handling etc) so you can use it directly with the PhoneGap/Cordova CLI. The resulting template is here in my GitHub repo. All you need to do is specify my URL as the template to use when creating your project from (as shown below) and you’re good to go.

    $ phonegap create myVueApp --template http://ift.tt/2jeMEik
    $ cd myVueApp
    $ phonegap serve
If you’re using the Cordova CLI, simply swap out the phonegap command for cordova above. Further instructions are located in the project README.

onsen-logo

Onsen UI

Onsen UI is another UI framework available for building hybrid apps. It’s built on top of Web Components and it’s flexible in that it allows you to use it with various JS frameworks including Angular 1 & 2, React, Vue, Meteor, or independent of a framework. It also has support for iOS and Android Material design with automatic styling based on the platform. Check out their kitchen sink apps for Angular 2 and React to get a better idea of what they have to offer.

Vue Support

Onsen UI currently has support for Vue in a preview version of a binding library you can try out that contains a set of components extended to work with Vue, however it’s currently dependent on Vue 1.x. Support for Vue 2 is in progress however and expected to be coming in the very near future. If you’re interested in trying out their current support, take a look at this blog post containing some important details.


Useful Resources


by Holly Schinsky via Devgirl's Weblog

Using MeasurementFormatter in Swift

The MeasurementFormatter class provides formatted and localized representations of units and measurements. When catering to a global audience, you should present this data in local units. Suppose your app shows the end user a distance between two points. Assume that the distance is in imperial units: feet, yards and miles. When catering to a global audience, you should present this data in local units. Consider the following:

The distance between New York and Paris is 3,626.81 miles

In French, you would want to not only translate the string’s text, but also the measurement units therein contained:

La distance entre New York et Paris est de 5 836,78 km

Instead of attempting to write your own utility classes to perform these conversions, you should leverage the power of Apple’s Foundation.
When dealing with distance measurements, MeasurementFormatter does great work with zero configuration. By the time the user installs your app, the user’s device has a default locale. Working with the distance measurement above, we can convert to the user’s localized standard:

Continue reading %Using MeasurementFormatter in Swift%


by Clay Unicorn via SitePoint