Wednesday, May 4, 2016

How to Stay Healthy While Freelancing from Home

Vegetables

Let’s face it: as freelancers who work from home, we aren’t as active as our 9-5 counterparts. We don’t get up and walk around for a while getting ready to leave in the mornings. We don’t have to walk or drive to get to work. We don’t have to leave our desk as often throughout the day.

[author_more]

Our 9-5 counterparts are getting up and moving around much more during the day than we are. Not only are we missing out on the benefits of getting up and moving around, we’re also more likely to be sitting in our chairs for longer periods of time. Not to mention that we often have more options for snacks and freedom to eat when and where we want, especially with the kitchen just a few steps away.

When you think about it, we aren’t nearly as active as our 9-5 counterparts, even though we work from home, control our schedules, and have more time to devote to keeping ourselves healthy. If you work from home, making sure you take care of yourself and your health is a bit more difficult than you think.

Some of the main health issues for freelancers who work from home (and even those who work for someone else) include weight gain, loss of energy, deteriorating strength and stamina, and eye strain. These are major issues those who work from home are more prone to developing.

There are ways to combat these health issues and to get back to being a healthy, productive you. We chose the freelancing lifestyle because we wanted freedom and control of our lives. Let’s not let this lifestyle impact our health and potentially take away some of that freedom and control we’ve worked so hard to get.

Below, I outline easy ways you can combat some of these most common health issues among freelancers so that you can start taking control of your health and happiness.

Weight Gain

Since switching to work-from-home freelancing, have you noticed any weight gain? Chances are you’ve noticed some extra weight since you started working exclusively from home. This is because of several reasons: less movement required to do your job, a more sedentary lifestyle, snacks and food are more accessible, and it’s easier to skip a workout.

The two main culprits of weight gain for freelancers are the decrease in movement during the day and the readily available snacks and food that can be had at a moment's notice. When you work so close to the place where you sleep and eat, you’re missing out on valuable steps and making it too easy to find things to eat and possibly overeat.

Since weight gain is likely the biggest health concern for freelancers, there are a few ways to make your freelancing lifestyle healthier and keep you from gaining weight. First off, get up and take a few walks during the day. You need to get away from your computer from time to time anyway (discussed below), so take a quick 15 minute walk around your house, on a treadmill, or outside (whatever works best for you).

This 15 minute walk gets your heart pumping and burns a few extra calories, all while helping you relieve stress, build muscle, and keep your metabolism up. Taking three 15 minute walks a day as a break means that you’ve exercised for 45 minutes by the end of the day. For most of us, that equals about 2.5 to 3 miles (4 to 5 kilometers) a day.

Second, combat the possibility of overeating by scheduling your breakfast, lunch, and dinner times. It’s too easy to get up and get something to eat whenever you want. If you schedule it, you can tell your brain that it isn’t time to eat yet, keeping you from overeating. If you are the type of person who needs snacks, invest in healthy snacks that you can eat (fruit, trail mix, subscribe to a healthy snack subscription like Graze or Nature Box), but even with these healthy snacks, don’t keep them where you work. Keep them in the kitchen so that you aren’t as tempted to eat them and possibly overeat.

Finally, stay away from sugary and caloric drinks (soda, sweet tea, coffee with tons of cream, etc.). These sugary drinks add on the pounds because it’s too easy to lose track of how much you’ve had during the day (not to mention the way sugar in particular contributes to weight gain). Stick to low or no calorie drinks such as water and tea.

Loss of Energy

For freelancers, loss of energy can be the result of several things: less sleep, lack of exercise, eating junk food, and being stationary all the time. When you feel you don’t have energy, it’s because you either deprived your body of something good, or you gave it something bad.

One way to fix loss of energy issues is to get enough rest at night. Getting your seven to eight hours of sleep makes you more productive, gives you a restful night, and allows your body time to heal and repair itself. Sleeping too little and fatigue starts setting in; sleeping too much can cause you to mess up your internal clock.

Another way to help get your energy back is regular exercise. Regular exercise such as cardio and strength training release feel-good endorphins that help get energized. Also, expelling the energy required to do the exercise helps your body get more tired and ready for bed, preventing you from tossing and turning and allowing you to get a more restful and restorative sleep.

Finally, eating better foods keeps you from having your energy drained unnecessarily. Eating junk foods with lots of added sugar give you a quick boost of energy, but they don’t last long at all. Finding foods that provide healthy benefits and long-lasting energy (proteins like nuts and fats like avocado) can help you get out of that low-energy rut. Just make sure those foods aren’t loaded with sugars or salts, and don’t overeat!

Continue reading %How to Stay Healthy While Freelancing from Home%


by Amber Leigh Turner via SitePoint

Creating Forms with the Webix Framework — 4 Practical Examples

This article was peer reviewed by Simon Codrington and Mallory van Achterberg. Thanks to all of SitePoint's peer reviewers for making SitePoint content the best it can be!

As a web designer, the chances are that you have to create web forms on a fairly regular basis. This is often a thankless task and one fraught with headaches (especially if you're doing something more complex, such as creating a multi-step form). In such cases it can be better to use a UI framework to ease the pain and to speed the development process. In this article I'll outline various tips and tricks that let you create different types of forms quickly and with minimum hassle using the Webix framework.

What is Webix?

[author_more]

Webix is JavaScript UI library of HTML5 components that facilitates the creation of mobile and desktop web apps. It provides you with a wide variety of components from a simple button to the SpreadSheet Widget that can be used for developing Excel-like applications. Besides the UI components collection, there's an event handling mechanism, offline mode support, and a bunch of development tools. You can also create your own skins using the skin builder, use visual designer for drag-and-drop UI creation and play with the code in online source code playground. The project also has exhaustive documentation.

I've already written an introductory article that describes the key features and basics of using this framework, so feel free to give that a look beforehand if you're interested.

Including Webix

There are a variety of ways in which you can include the required JavaScript and CSS files in your project. If you download the library package, you'll find these files within the codebase folder. You can include them as follows:

<link rel="stylesheet" href="./codebase/webix.css">
<script src="./codebase/webix.js"></script>

Alternatively you can use CDN:

<link rel="stylesheet" href="http://ift.tt/1Qr9UoG">
<script src="http://ift.tt/1bnVGEy"></script>

You can also use NuGet:

nuget install Webix

Whereby if you use Microsoft Visual Studio, execute this from Package Manager Console:

install-package Webix

Or try Bower:

bower install webix

Creating a Simple Form

Now, with the libraries in place, let's see how the Webix Form Widget works.

webix.ui({
  view: "form",
  id: "myForm",
  container: "areaA",
  width: 350,
  elements: [
    { // first form component },
    { // second form component},
    { // n-th form component */}
  ]
});

We start off by calling the ui method of the webix object and passing it various parameters to configure its output.

  • The view property dictates the kind of element created (here we are creating a form, but this could also be a menu or a chart).
  • The id property assigns an ID to the form, through which you can later reference it.
  • The container property specifies the ID of the HTML element into which the form should be rendered.
  • The width property is used to set the width of the form element. Webix assumes that you want to use pixels as a unit of measurement here, so you just need to set a proper number.
  • The elements property is an array of components that your form will contain. You can use any appropriate component within the form: text field, radio button, checkbox, buttons, etc.

Let's create a simple login form. We'll need two text fields (one for username and one for the password), one checkbox, and, of course, a submit button.

webix.ui({
  ...
  elements: [
    { view: "text", label: "Username", name: "username" },
    { view: "text", label: "Password", name: "password", type: "password" },
    { view: "checkbox", labelRight: "I accept the terms of use", name: "accept" },
    { view: "button", value: "Submit", width: 150, align: "center", click: submit }
  ]
});

Note that we are specifying name attributes for our form elements and setting type: "password" for our password field, so as to mask the characters as they are entered. Setting an element's label property defines a label for that element and we can use an element's click property to define an event handler that will be called when the form is submitted. Although it is nice to have the possibility of checking that everything is ok with the data, don't forget that client-side validation should only ever supplement server-side validation.

Before we can run this demo, we'll need to define this event handler. Here I'm using Webix Message Box to give the user feedback as to what was entered:

function submit(){
  webix.message(JSON.stringify($$("myForm").getValues(), null, 2));
}

This code uses the Webix getValues method to derive the inserted data from the form with an ID of myForm and then converts it to a JSON string using JSON.stringify().

Well, everything is ready, and we can check the result:

Simple Webix form with three fields

After you insert some data and hit the Submit button you'll get the message:

Webix message box displaying field values on submission

Here's the demo:

See the Pen NNBgWm by SitePoint (@SitePoint) on CodePen.

Seems like everything works well. Now, let's add something more interesting.

Continue reading %Creating Forms with the Webix Framework — 4 Practical Examples%


by Sergey Laptick via SitePoint

Stop Maiming Bodies: The Perils of Pixel Font-Size

[caption id="attachment_129462" align="aligncenter" width="600"]An eye test for pixel size Artwork by SitePoint/Natalia Balska[/caption]

Imagine you’re visually impaired or have a reading disability. The browser comes with a font size setting built in, so you increase the default font size and you start browsing. Oddly, the text on most sites still seems small, so you go back to the browsers settings and increase font size to huge. You return to the website you were on and... nothing. The setting has no effect.

Font size setting in Google Chrome

Past few years, we have learned how to use and gradually accepted relative units for typographic content. Instead of using pixels for properties like font-size, most values are rem or ems.

Many developers still set an ‘initial’ font-size on the html or body tag, often using px as unit. If you don’t fully understand (and appreciate) relative units, this might be convenient for you, as all em and rem are now relative to that initial value.

/* A body containing a font-size with absolute value */
body { font-size: 14px; }

/* The h1 will be 2em relative to 14px */
h1 { font-size: 2em; }

Unfortunately, that initial value isn’t convenient for some users. You see, that browser setting I mentioned earlier, only sets the base font size. Every absolute unit (px, pt, inch, etc.) you use, overwrites that.

/* Fictional browser setting */
html { font-size: 18px; }
/* The absolute unit in the body overwrites the browser setting */
body { font-size: 14px; }

Continue reading %Stop Maiming Bodies: The Perils of Pixel Font-Size%


by Tim Severien via SitePoint

mFancyTitle – jQuery Plugin to Animate Your Page Title and Favicon

mFancyTitle is the jQuery plugin that lets you animate your document <title> & favicon easily with style.


by via jQuery-Plugins.net RSS Feed

This Week's HTML5 and Browser Technology News (Issue 238)


Read this e-mail on the Web
HTML 5 Weekly
Issue 238 — May 4, 2016
Aleks Hudochenkov
A look at using PostCSS to inline images, calculate dimensions, inline and modify SVGs, and more. PostCSS is an increasingly powerful part of the front-end arsenal.


Ricardo Zea
An incredibly thorough look at pseudo-classes (like :first-child) and pseudo-elements (like :before) with plenty of live Codepen examples.


Sarah Drasner
A thorough comparison of both native and library-based Web animation technologies with useful pros and cons to help you choose for your next project.


Frontend Masters  Sponsored
You probably use dev tools for tweaking CSS or the interactive console...but there is so much more! Let’s look at everything the dev tools have to offer. Join Jon Kuperman and learn how to edit, debug and profile web applications with Chrome Dev Tools.

Frontend Masters

Paul Kinlan
As part of Chrome’s intent to deprecate powerful features on non-secure origins, it no longer supports the HTML5 Geolocation API over non-secure connections.


Karim Maaloul
A thorough tutorial covering the basics of creating animated 3D scenes in the browser using Three.js.


A List Apart
Tim Baxter encourages us to move beyond ‘classitis’ (the “measles of markup”) to writing rich, semantic HTML and CSS. Only habit is stopping us.


Lucas Bebber
How to use fragment shaders in WebGL to create an animated heat haze distortion effect on images and text.


Jobs

  • The Easiest Way to Find a JobHired lets you sit back while job offers come to you. When you complete your profile, instantly apply to 3,500+ companies on the platform who will contact you with job offers, including salary and equity up-front. Try it today. Hired.com

In brief

Curated by Peter Cooper and published by Cooper Press.
Want to post a job? E-mail us or use our self-serve system.

Unsubscribe : Change email address : Read this issue on the Web

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


by via HTML5 Weekly

How to Design a Daring but Effective Split-Screen Layout

Split-screen layouts are full-screen web components that are divided into two (or more) equal vertical columns.

However, despite the fact that split-screen layouts are white-hot trendy, it is a bold stylistic decision that can hurt the user experience if there isn't a sound, logical reason behind your choice.

Saying that, when executed correctly it can offer users a wonderful viewing experience.

[caption id="attachment_129575" align="aligncenter" width="800"]Split-screen site design by Roman Kirichik Split-screen site design by Roman Kirichik[/caption]

Why Use a Split-Screen Layout?

Split-screen components work best in minimalist web designs because the negative space combined with the bold vertical divide adds a supreme amount of focus on the important areas.

Aside from these advantages, the benefits to split-screen layouts extend way beyond visual aesthetics; they're especially effective for landing webpages with two side-by-side selectable options.

Some obvious examples include:

  • Login and signup forms
  • Paid and free subscriptions
  • Products that come in alternate colours

Great Examples of Split-Screen Components

First, let's take a look at some terrific examples and discuss why they work so well for their use-case. Split-screen layouts can be used in many different ways, so the advantages vary from site-to-site, depending on what the website sets out to achieve.

Cam Strobel

Not every website design needs access to the entire horizontal viewport. With ultra-minimal designs, like Cam Strobel's website, splitting the screen into two vertical columns means that all of the content can be above-the-fold, completely eliminating the need for the user to scroll.

Cam Strobel

Studio Meta

Full-width "big header" designs are still quite common - it's a huge trend and rightfully so, however, there's rarely an opportunity to use bold imagery due to the lack of text legibility (we usually have to the blur the image or add a colour overlay). Split-screen layouts solve that, and Studio Meta shows us exactly how.

By having the image and content side-by-side, we can use images that are more colourful, more courageous, and with a much deeper meaning because we don't have to obscure the image in any way.

Studio Meta

Bose

Split-screens don't have to consist of two 50/50 components - Bose takes this trend to the limit, although I did notice that the website doesn't even try to adapt to smaller screens. Regardless of how beautiful this looks, responsive design is something you have to consider, and it can be quite hard to adapt split-screen layouts to smaller devices.

Aside from that, this is my favourite split-screen example because the layout allows Bose to show off each item with a unique personality by using different colours. Combined with the edgy diagonal shapes, this website really catches my eye.

Bose

Fillet is another wonderful example of how split-screen layouts can inject individual personality into web components of equal importance. Plus, because there are only three vertical columns and almost no content (each column showcases artwork), this displays correctly on mobile devices.

Continue reading %How to Design a Daring but Effective Split-Screen Layout%


by Daniel Schwarz via SitePoint

Building a SparkPost Client: TDD with PhpUnit and Mockery

In a previous post, we looked at SparkPost (as an alternative to Mandrill), and explored a bit of the official PHP client. The official client handles a decent amount of work, but I got to thinking about what it would take to build a new client.

The more I thought about it, the more it made sense. I could learn about the SparkPost API, and practice Test Driven Development at the same time. So, in this post we'll look to do just that!

Home page screenshot

You can find the code for this post on Github.

Getting Started

To begin, we're going to need Guzzle to make requests to the SparkPost API. We can install it with:

composer require guzzlehttp/guzzle

In addition, we're going to be writing tests early, so we should also install PHPUnit and Mockery:

composer require --dev phpunit/phpunit mockery/mockery

Before we can run PHPUnit, we need to create a configuration file:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit
    backupGlobals="false"
    backupStaticAttributes="false"
    bootstrap="vendor/autoload.php"
    colors="true"
    convertErrorsToExceptions="true"
    convertNoticesToExceptions="true"
    convertWarningsToExceptions="false"
    processIsolation="false"
    stopOnFailure="false"
    syntaxCheck="false">
    <testsuites>
        <testsuite>
            <directory suffix="Test.php">tests</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist addUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">src</directory>
        </whitelist>
    </filter>
</phpunit>

This configuration file handles a number of things:

  1. Many of the root node attributes are sensible, intuitive defaults. The one I want to draw particular attention to is bootstrap: which tells PHPUnit to load Composer's autoload code.
  2. We tell PHPUnit to load all files ending in Test.php, in the tests folder. It will treat all files with this suffix as though they are class files with a single class each. If it can't instantiate any of the classes it finds (like abstract classes) then it will just ignore those.
  3. We tell PHPUnit to add all PHP files (from the src folder) to code coverage reporting. If you're unsure what that is, don't worry. We'll look at it in a bit...

We can now run:

vendor/bin/phpunit

... and we should see:

New phpunit screen

Continue reading %Building a SparkPost Client: TDD with PhpUnit and Mockery%


by Christopher Pitt via SitePoint