Saturday, October 31, 2015

Study: Is Online Paid Media Still Effective in 2015? - #infographic

Everyone Hates Online Advertising… Does Paid Media Still Work? - #infographic

Did you know that 79 percent of users almost never click online ads, and that 38 percent of users don't pay attention to internet advertisement.

What if I told you that personalized and behavior-based ads are not perceived favorably, 71 percent find them intrusive or annoying.

Although, 55 percent say a relevant message is the top factor that'd make them click an ad, and some 36 percent have discovered a new product or brand through an online advertisement, yet 90 percent have never made a purchase commitment or submitted their contact information after clicking on an ad.

by Irfan Ahmad via Digital Information World

LACOSTE - F/W OUTERWEAR 2015

The first 360 Interactive Lookbook launched by Lacoste in China. Immerse yourself in a snow globe where time has stood still and discover the LACOSTE F/W OUTERWEAR 2015 collection.
by via Awwwards - Sites of the day

Google Embraces Podcasting: This Week in Social Media

gd-weekly-news-nov-2-2015-560

Welcome to our weekly edition of what’s hot in social media news. To help you stay up to date with social media, here are some of the news items that caught our attention. What’s New This Week Google Play Music Welcomes Podcasts: “Along with direct searches and browsing for podcasts, the service will connect new […]

This post Google Embraces Podcasting: This Week in Social Media first appeared on Social Media Examiner.
Social Media Examiner - Your Guide to the Social Media Jungle


by Grace Duffy via Social Media Examiner

Material ScrollTop Button : jQuery Plugin

Lightweight, Material Design inspired plugin for scrolling on top of the html page (with jQuery).

  • Lightweight
  • Material Design inspired
  • With ripple effect
  • Smoothly animated
  • Customizable
  • CSS3 (Sass) + jQuery

The post Material ScrollTop Button : jQuery Plugin appeared first on jQuery Rain.


by Admin via jQuery Rain

Vidbg.js : HTML5 jQuery Video Background plugin

Vidbg.js is a html5 jQuery video background plugin.When resizing is set to true (default) the video will resize automatically when the window is expanded or compressed.

  • All modern web browsers
  • IE9+
  • Video will play on desktops and laptops and will resort to the fallback image (poster) on mobile devices (tablets, phones, etc.)

The post Vidbg.js : HTML5 jQuery Video Background plugin appeared first on jQuery Rain.


by Admin via jQuery Rain

CountChar : jQuery Counter of Character plugin

A simple counter of characters for multiple form fields based on jQuery.

The post CountChar : jQuery Counter of Character plugin appeared first on jQuery Rain.


by Admin via jQuery Rain

Friday, October 30, 2015

#SocialMedia Tips: How To Use Hashtags To Increase Your Engagement And Followers - #infographic

#Social Media Tips: How To Use Hashtags To Increase Your Engagement And Followers - #infographic

"Hashtags can increase awareness, get your content seen by more people than just your followers, and boost your social shares.

But if used incorrectly, they can lower the credibility of your content and cost you followers.

So are you doing everything you can to get the most out of your #hashtags?"

Find out the answer in this infographic, which comes courtesy of Coschedule.

by Irfan Ahmad via Digital Information World

Create a Tabbed Browser Using Node-Webkit and AngularJS

This article was peer reviewed by Edwin Reynoso, Tim Severien and Divy Tolia. Thanks to all of SitePoint’s peer reviewers for making SitePoint content the best it can be!

In the past, cross-platform software development often meant writing the same application in different languages for different operating systems. As you can imagine, this was a difficult situation for project managers, developers and customers alike.

Then, in 2011, Roger Wang introduced something called Node-Webkit. Node-Webkit (which has since been renamed to NW.js) is a combination of Node.js and an embedded WebKit browser which allows developers to use web technologies (i.e. HTML, CSS and JavaScript) to develop native apps. Yes, that’s right! We get to write native apps, using all the goodies that are supported in our modern browsers. For example, CSS3 animations, WebGL, WebRTC, video, audio, and plenty more can all be incorporated into a native application.

In this tutorial, I am going to demonstrate how to harness the power of NW.js to make a tabbed browser, which can be deployed on all major operating systems. As ever, the code for this tutorial can be found on our GitHub repo.

Initial Setup

[author_more]

As the name suggests, NW.js is based on Node, so you’ll need to have that installed on your operating system. We’ll also be making use of npm (the Node Package Manager). If you need help getting either of these things set up, then check out our tutorial: A Beginner’s Guide to npm.

Next we’ll need a folder for our project:

mkdir sitepoint-browser && cd sitepoint-browser

We’ll also need some dependencies that should be installed globally (namely, Yeoman, Grunt and Bower):

npm install -g yo grunt bower

Of these, Yeoman (AKA Yo) is a tool to scaffold everyday projects dynamically, thereby avoiding the hurdles of always having to create reusable project structures manually. Grunt is a task runner which Yeoman uses. It also uses npm and Bower to install required dependencies.

Next, we’ll install Yo’s generator-wean. You can either do this globally or locally. Here I’ll do it globally:

npm install -g generator-wean

NW.js itself has a handful of generators but generator-wean (authored by me) comes bundled with ExpressJS and AngularJS which eases the stress of installing and configuring them. WEAN stands for Webkit, Express, Angular and Node just like the popular MEAN.

Now our skeleton app can be generated with one command:

yo wean

Yo is an interactive guy and the generator will ask you some questions in order to assist in making a project that best suits what you want. Here you can just accept the defaults.

Folder Structure

The folder structure will look like so:

.
├── app
│   ├── app.js
│   ├── index.html
│   ├── public
│   │   ├── css
│   │   │   └── app.css
│   │   ├── js
│   │   │   └── app.js
│   │   ├── libs
│   │   │   ├── angular
│   │   │   ├── bootstrap
│   │   │   └── jquery
│   │   └── partials
│   │       └── header.html
│   ├── routes
│   │   └── index.js
│   └── views
│       └── index.ejs
├── node_modules
├── bower.json
├── Gruntfile.js
├── package.json
└── README.md

For this project, we are interested primarily in the contents of the public directory. The generator will have filled these files with a bunch of boilerplate (a very simple Angular app), but we will be addressing that as we go.

We can now run the skeleton app using:

grunt run or just grunt

This command can be used at any point in the app development to preview changes. It executes the NW.js project which in turns uses Express for routing just as you would when making a web application. This is a good example of how we can use Node modules in NW.js by injecting them in the app/index.html after initializing.

NW.js also has developer tools and toolbars where we can find controls to refresh, debug, inspect, log, etc just as we do when building a web application in Chrome. You can access these by clicking the hamburger icon in the skeleton app.

Dealing With the UI

The most important aspect of this tutorial is to be able to surf the internet from our native application. The webview and iframe tags are perfect candidates for our plan. The webview tag is effective but quite new to the game as it was only recently added to NW.js. The iframe tag, however has been around since HTML 4 and has wide support. We will use it because it is well-known to most developers.

Bootstrap will serve as the base for our UI. We will use a custom bootstrap theme named Slate from Bootswatch. Download Slate and place it in app/public/css/bootstrap.css.

For our icons, we will make use of Font Awesome. From the project root run:

bower install --save fontawesome

This will download Font Awesome to our libs folder just like other bower dependencies. This is because we specify the following line in the .bowerrc file in our project root (the default is otherwise bower_components).

{
  "directory" : "app/public/libs"
}

Fortunately, Bootstrap will handle most of the UI tasks but we need to tweak some of the components and contents to actually make a browser that looks good. To achieve this, we will write some simple and short CSS and place it in app/public/css/app.css:

html,
.tab-content,
.tab-pane,
body > div {
  height: 100%;
}

iframe {
  background: white;
}

.controls {
  position: fixed;
  top: 10px;
  right: 8px;
}

.controls > i {
  padding: 0 3px;
}

.controls > i:last-child {
  color: red;
}

.controls > i:hover {
  color: white;
  cursor: pointer;
}

.close-tab:hover {
  color: red;
  cursor: pointer;
}

The html, body, tab-content and tab-pane height are set to 100% to ensure that regardless of the size of our browser app, the content should fill up the height of the window. By default, width is 100% so there is no need to explicitly specify it. We also give a minimal style to our browser controls which we will be seeing in a while.

Continue reading %Create a Tabbed Browser Using Node-Webkit and AngularJS%


by Christian Nwamba via SitePoint

What Is a Core Data Fault?

Handling POST Requests the WordPress Way

An interactive website needs to be able to interact with user input, which is commonly in the form of form submissions. A WordPress site is no exception to this rule. There are various interactions happening on a website on a daily basis. For example, subscribing to a newsletter, sending a message to the site owner and filling in an order form. All of these usually happen from POST requests during a form submission.

WordPress Transients API

In this article, we're going to take a simple example of handling a POST request from a user, which is submitted via a contact form. We are going to use an internal WordPress hook to properly get the data, process it accordingly and redirect the user back to a specific page.

This article assumes you have a basic knowledge of the WordPress Plugin API. If you’re not familiar, it’s highly recommended to become review the Codex page first.

The Background

WordPress is based on an event driven architecture. This means internally, WordPress core is filled up with various actions and filters to modify the program execution or to alter the content during runtime. Examples of actions that are running during program execution are init, wp, template_redirect and wp_head. Many plugins utilise these actions and filters to modify how WordPress works.

It is no different with what we are going to achieve. All we need to know is the proper hooks needed for the POST request and to modify our code accordingly. This is possible by pointing all our form submissions to a specific file in the wp-admin directory called admin-post.php. If you have experienced integrating your application with WordPress internal AJAX API, then you will notice that the basic structure of admin-post.php is not much different to the admin-ajax.php counterpart.

Continue reading %Handling POST Requests the WordPress Way%


by Firdaus Zahari via SitePoint

New Course: Animate Your Site With AngularJS

13 Tips on Designing and Building Apps More Efficiently

Programmer

I've been thinking a lot lately about all the small utility apps I've programmed over the years and how I could have designed them better.

I loosely define a utility as any project designed to solve a singular and specific problem for a certain situation or business process.

For example, I built a small PHP application that accepts an export from an ecommerce store and parses the data into another format needed for a specific business process.

How could I design these better?

I normally build a utility by having an idea of a problem to solve, and I jump right in to an editor and start typing.

Some time later, I find myself wanting to steal functionality from old utilities, but when I go to reuse some code, I find out how badly I programmed the thing! Generally I don't spend a lot of time on small utilities, so they are programmed without classes, namespaces, or even OOP. Procedural FTW!

It's made me think that I should be more organized, even in tiny projects.

Here are some issues I now consider before starting any new project.

1) The basics are required!

Regardless of how tiny the utility is, practice good programming! Use proper source formatting, naming conventions and commenting. Another developer should be able to see what's going on in the code with little effort.

Avoid procedural coding where possible.

I no longer allow myself to write sloppy code, even if the project is tiny or of limited use.

2) Define the project

It doesn't matter if the utility has a single function to perform: it should be well defined before coding begins. The definition of the app will include basic declarations, like who will use it, what data it will expect, and what output it's supposed to give.

Define data sources, security concerns, and whether the app will grow with more functions over time.

Where will the utility be hosted?

The more detailed the definition, the easier it is to pick tools and stay in scope while programming it. This is especially true if you're programming for someone else!

App development

3) Will others work on it?

If other programmers will be involved, increase your documentation and commenting. Use source control, and focus on separation of concerns in your classes and methods.

If no programmer will ever need to read your code or work on it except you, keep to the basics and don't overwhelm yourself. Just make sure you can still make sense of it!

4) Source control?

Depending on the context of the utility—such as if it is an internal project for an organization that will own the work—the code may be hosted in a public repository. If so, increase documentation; add a readme.md file; add DocBlocks to define ownership of the code, and use Semantic Versioning.

If there are concerns about intellectual rights and who owns the code, this would require you to throw a license in there.

5) Do I have to maintain it for the long haul?

If you foresee future development, assume that others will work on the app, and that it therefore needs source control, improved documentation, and a license attached.

You may not be the person to maintain future versions if the app is internal to an organization. It's better to spend the extra time on these chores than for future programmers to dismiss you as a poor programmer.

If you write well-documented code, you may be able to come back later for a letter of recommendation. (You can't take company-owned code with you, but at least you'll have a letter confirming all your work was good!)

Continue reading %13 Tips on Designing and Building Apps More Efficiently%


by Zack Wallace via SitePoint

True Digital

Digital Marketing Agency in Bristol, UK.


by csreladm via CSSREEL | CSS Website Awards | World best websites | website design awards | CSS Gallery

What You See Is What You Get

Personal or commissioned, big budget or small, the most important rule is: it’s got to be great. Photography by Anderson – UK


by csreladm via CSSREEL | CSS Website Awards | World best websites | website design awards | CSS Gallery

Dr Schilhan Facility Services

The new website for the leading facility services company in Austria


by csreladm via CSSREEL | CSS Website Awards | World best websites | website design awards | CSS Gallery

This week's JavaScript news, issue 256

This week's JavaScript news
Read this e-mail on the Web
JavaScript Weekly
Issue 256 — October 30, 2015
You don’t need to upgrade your Angular 1 apps to Angular 2, but if you do, here are some insights and a process to follow.
Pascal Precht

Once known as solely an ES6-to-ES5 compiler, Babel is now a plugin-based general JavaScript tooling platform. This is a big shift.
Babel

From using GraphQL and WebGL with React, to Falcor and webpack.
YouTube

Angular lets you build dynamic, single-page web applications from scratch that are so smooth your users will forget they're still inside a web browser. Sign up online and start learning today!
Thinkful   Sponsored
Thinkful

A good looking one though, and the live customizable demo on the homepage is a superb feature.
Victor Vincent

With 172k @JavaScriptDaily followers, we decided to test the new ‘poll’ feature. So far only 32% claim to be using ES6 for most of their work.
Twitter

Not exactly new ground, but this article from Smashing Magazine provides a good, quick code-driven overview.
Lars Kappert

Mathias Bynens looks at the many problems related to Unicode in JavaScript regular expressions, how ES6 helps, and how to fix issues you run into.
JSConf EU 2015

A straightforward tutorial on compiling some simple C programs to JavaScript (on Windows 10 but OS X and Linux work similarly).
SitePoint

Jobs

  • (Senior) JavaScript Developer (m/f) at ShoreShore is looking for passionate developers who breathe JavaScript. Join a startup & write production-ready ECMAScript 2015 in an agile environment. Promise.resolve('challenge').then((c) => You.accept(c).at(Shore)) Shore GmbH
  • Principal Javascript Developer at Brightcove (Boston, MA)Join the team that builds video.js, one of the most popular HTML video players on the web. Work with cutting-edge browser APIs, repackage video content on-the-fly, and support a project that web developers love. Brightcove
  • Applications Developer (Pasadena, CA)IPAC, the Infrared Processing and Analysis Center, is a partner in the Large Synoptic Survey Telescope (LSST) and is developing the Science User Interface and Tools (SUI/T) for science community access to the data. California Institute of Technology

In brief

Curated by Peter Cooper and published by Cooper Press.

Stop getting JavaScript Weekly : Change email address : Read this issue on the Web

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


by via JavaScript Weekly

Powerful Custom Entities with the Diffbot PHP Client

A while back, we looked at Diffbot, the machine learning AI for processing web pages, as a means to extract SitePoint author portfolios. That tutorial focused on using the Diffbot UI only, and consuming the API created would entail pinging the API endpoint manually. Additionally, since then, the design of the pages we processed has changed, and thus the API no longer reliably works.

In this tutorial, apart from rebuilding the API so that it works again, we’ll use the official Diffbot client to build custom entities that correspond to the data we seek (author portfolios).

Diffbot logo

Bootstrapping

We’ll be using Homestead Improved as usual. The following few commands will bootstrap the Vagrant box, create the project folder, and install the Diffbot client.

git clone https://github.com/swader/homestead_improved hi_diffbot_authorfolio; cd hi_diffbot_authorfolio
./bin/folderfix.sh
vagrant up; vagrant ssh
mkdir -p Code/Laravel/public; cd Code/Laravel; touch public/index.php
composer require swader/diffbot-php-client

Additionally, we can install Symfony’s vardumper as a development requirement, just to get prettier debug outputs.

composer require symfony/var-dumper --dev

If we now give index.php the following content, provided we added homestead.app to our host machine’s /etc/hosts file, we should see “Hello world” if we visit http://homestead.app in our browser:

<?php
// index.php

require '../vendor/autoload.php';

echo "Hello World";

Diffbot Initialization

Note that to follow along, you’ll need a free Diffbot token - get one here.

define('TOKEN', 'token');
use Swader\Diffbot\Diffbot;

$d = new Diffbot(TOKEN);

This is all we need to init Diffbot. Let’s test it on a sample article.

Continue reading %Powerful Custom Entities with the Diffbot PHP Client%


by Bruno Skvorc via SitePoint

Charm

Charm

'Charm' is a One Page HTML template with a flat design suited for portfolios. "Scrolljacking" effect aside the template features a nice subtle parallax effect as you start to scroll. Other features include a Tweet slider, pricing table, client logo slider and a portfolio using Lightcass.css - a new Lightbox style plugin to browse your projects.

by Rob Hope via One Page Love

NTMY

opl-small

One Pager for 'NTMY' - a new conversation based show & podcast hosted by Tobias van Schneider. Quite a neat reference to how simple you can launch a new podcast in a Single Page website with clean typography and Soundcloud embedded episodes.

by Rob Hope via One Page Love

Creating Wearables? Here Are 6 Ideas to Consider

I recently heard Google Glass described as the Segway of wearables and I’m still smiling.

Whether you believe wearables are a dynamic and growing part of consumer technology or a short term trend favored by early adopters, it’s a innovative sector that’s hard to ignore. Wearables are media friendly, at the forefront of R&D and instrumental in linking two seemingly disparate sectors, fashion and technology. Beyond Google Glass, there are better examples of wearables and fashion.

You’ve probably thought about being the creator of the next Pebble or Fitbit but what about working in fashion? I undertook some research and interviewed three people working in fashion wearables in Berlin, Brooklyn and Shanghai and came up with a list of 6 things to consider.

Continue reading %Creating Wearables? Here Are 6 Ideas to Consider%


by Cate Lawrence via SitePoint

Output Group™

opl-small

Parent company One Pager for 'Output Group™' that lists it's 4 main divisions of business. The Single Page sites starts with a video highlighting their services followed by the latest project from each of it's child companies.

by Rob Hope via One Page Love

Interested in Writing for Tuts+ Code?

For the first time in over a year, we're looking to add more instructors to our team. Specifically, we're looking for those who have strong skills in Ruby, Rails, JavaScript, and more, all of which we'll cover momentarily.

What's required to become an instructor for an established educational network like Envato? Depending on the level of experience you have with any of the above technologies, it could mean a variety of things. 

Here's a breakdown of everything we're looking for and what you need to know in order to apply to join the team.

The Skills We Need

For those of you who are regular readers, you know that we aim to publish content on Tuts+ Code that focuses on web development technology. Sometimes, we do a call for instructors across a variety of areas.

This time, we're looking for people who have a deep knowledge of the following topics:

  • Ruby
  • Rails
  • Laravel
  • HTML5
  • JavaScript (and related frameworks and libraries)

Regardless of whether you work with these in a professional capacity or as a hobby, we're looking for people who are well-versed and passionate in all of the above to help educate others.

Writing a High-Quality Tutorial

If you're looking for tips on how to write high-quality tutorials, here are some quick pointers:

  • Look at projects that you've recently completed and the most challenging aspects of them. What did you learn? This is content that would make for a good post.
  • Review your email and see if others have asked you any questions recently. If so, take a look at the answers you've provided and then use them as inspiration for a post.
  • Look at some of the things that you've used in past writings or courses to teach others, and take advantage of that content to seed ideas for content.

Of course, there's more. For more information on what it means to write a high-quality tutorial for us, please review this post.

How Much Can You Earn?

One of the first questions that every instructor has with respect to writing for us is: "How much will I get paid?"

Given the topics that we're looking for, pay rates start at $250 USD per article. We offer $60 USD for quick tips. We are also willing to discuss rates for higher profile authors and educators.

Furthermore, if you're a regular instructor who consistently meets deadlines, provides high-quality content, and follows up with readers in the comments, then you can expect to earn more as you continue to work with us.

Apply to Be an Instructor

You can visit this page to apply, but before doing this, please consider the following points:

  • As mentioned, we're looking for those of you who have a deep knowledge of the aforementioned languages and technologies.
  • We're looking for developers who have some experience in writing; however, we do have a review and copy editing process that we'll use to make sure your writing follows our standards.

What information is required to apply?

  • Your name
  • A brief paragraph about your background and why you're a good fit
  • A link to an article that you've written, helped create, or like
  • Two ideas for tutorials that you'd like to write for us
  • Examples of your work, either attached images or a link to your portfolio

Note that e-mails with just a couple of sentences or without ideas for articles will be discarded. We're looking for passionate instructors to teach passionate readers.

Applications are taken on a "first come, first served" basis. They should include any prior experience you have—as asked for on the form—as well as ideas that you have for articles.

Though pitching an article doesn't guarantee an opportunity for authorship, it will allow us to talk with you about your potential for writing for us.

With that said, I look forward to hearing from you and I can't wait to see what you bring to the table to help us!


by Tom McFarlin via Tuts+ Code

Using PostCSS with BEM and SUIT Methodologies

In this tutorial we’re going to learn how to use PostCSS to make development of BEM/SUIT style CSS easier and more efficient.

These two methodologies lay out a naming convention for classes that makes it easier to keep your styles tightly function-oriented, and helps other developers recognize the purpose of various classes just from the way they’re named.

BEM was the forerunner of this type of class naming methodology, created by Yandex. The SUIT methodology is an approach based on BEM, but with some adjustments and additions made by Nicholas Gallagher. SUIT does everything BEM does, but to many users it is considered an enhancement.

Working with these methods definitely helps to produce better, more well structured CSS. However, the tricky part is that it can become tiresome manually typing out the class names required in this structure, and keeping track of how classes inter-relate can become a bit of a headache. 

The postcss-bem plugin by Malte-Maurice Dreyer alleviates these issues through a combination of shortcuts and nesting, which you will learn to use as we move through this tutorial.

But first, let’s have a quick primer on the BEM and SUIT methods, to make sure you have a clear picture of the benefits of using the postcss-bem plugin, and of the way it’s used.

Quick Primer on BEM

Block

In BEM blocks are high-level chunks of a design; the building blocks the site is made from. A block should be a piece of your site that’s independent of other pieces, and could theoretically be placed anywhere in your layout, even nested inside another block.

For example, search form “blocks” on your site might use the class .search-form.

Element

An element in BEM is a subsection inside a block. They are signified by appending a two underscore __ separator and an element name to the parent block name.

For example, a search form might include heading, text field and submit button elements. Their class names might be .search-form__heading.search-form__text-field and .search-form__submit-button respectively.

Modifier

A modifier is applied to a block or element to signify a change in its presentation, or a change in its state. They are signified by appending a separator and a modifier name to the block or element in question.

The official BEM site docs state that modifier separators should be a single underscore _. However the "BEM-like" convention of CSS Guidelines by Harry Roberts employs two dashes -- and is probably more widely used and known than the official BEM convention.

For example, in a design you may wish to present advanced search forms differently to regular search forms, and hence create the modifier class .search-form_advanced (official BEM) or .search-form--advanced (BEM-like).

In another example, you might want to change the form’s appearance due to a change in state, such as if invalid content has just been submitted, and hence create the modifier .search-form_invalid (official BEM) or  .search-form--invalid (BEM-like).

Quick Primer on SUIT

SUIT comprises Utilities and Components. Within components there can be Modifiers, Descendants and States.

SUIT uses a combination of pascal case (PascalCase), camel case (camelCase) and dashes. Its conventions enforce a limit on the sometimes confusing number of dashes and underscores that can appear in BEM. For example, the BEM class .search-form__text-field would be .SearchForm-textField in SUIT.

Utility

Utilities handle structure and positional styling, and are written in such a way that they can be applied anywhere in a component. They are prefixed with u- and written in camel case. For example, .u-clearFix.

Component

A component in SUIT takes the place of a block in BEM. Components are always written in pascal case and are only part of SUIT that uses pascal case, making them easy to identify. For example, .SearchForm.

Component Namespace

Components can optionally be prefixed with a namespace and single dash nmsp- to ensure conflicts are prevented, e.g. .mine-SearchForm.

Descendent

A descendent in SUIT replaces an element in BEM. It uses a single dash - and is written in camel case. For example .SearchForm-heading.SearchForm-textField and .SearchForm-submitButto.

Modifier

SUIT uses modifiers as does BEM, however their role is more tightly controlled. A SUIT modifier is generally only applied directly to a component, not to a descendent. It should also not be used to represent state changes, as SUIT has a dedicated naming convention for states.

Modifiers are written in camel case and are preceded by two dashes --. For example,  .SearchForm--advanced.

State

State classes can be used to reflect changes to a component’s state. This allows them to be clearly differentiated from modifiers, which reflect modification of a component’s base appearance regardless of state. If necessary, a state can also be applied to a descendent.

States are prefixed with is- and are written in camel case. They are also always written as adjoining classes. For example  .SearchForm.is-invalid.

Setup Your Project

Now that you have the essentials of BEM and SUIT down, it’s time to setup your project.

You’ll need an empty project using either Gulp or Grunt, depending on your preference. If you don’t already have a preference for one or the other I recommend using Gulp as you’ll need less code to achieve the same ends, so you should find it a bit simpler to work with.

You can read about how to setup Gulp or Grunt projects for PostCSS in the previous tutorials

respectively.

If you don't want to manually setup your project from scratch though, you can download the source files attached to this tutorial, and extract either the provided Gulp or Grunt starter project into an empty project folder. Then with a terminal or command prompt pointed at the folder run the command npm install.

Install Plugins

Next, you’ll need to install the postcss-bem plugin. We'll also be installing a plugin that can work in with it quite well: postcss-nested.

Whether you’re using Gulp or Grunt, run the following command inside your project folder:

Now we’re ready to load the plugins into your project.

Load Plugins via Gulp

If you’re using Gulp, add these variables under the variables already in the file:

Now add each of those new variable names into your processors array:

Do a quick test that everything is working by running the command gulp css then checking that a new “style.css” file has appeared in your project’s “dest” folder.

Load Plugins via Grunt

If you’re using Grunt, update the processors object, which is nested under the options object, to the following:

Do a quick test that everything is working by running the command grunt postcss then checking that a new “style.css” file has appeared in your project’s “dest” folder.

Okay, you’re ready to go. Let’s learn how to generate BEM and SUIT structure.

BEM and SUIT with postcss-bem

There can be some unwieldiness developing in BEM or SUIT structure when writing code out manually, as continually repeating the same identifiers in class names can become tiresome, and keeping track of which elements and descendents belong to which blocks and components can get confusing.

When you use postcss-bem however, it becomes easy to make sense of the structure of your code at a glance, and repetition in typing out class names becomes virtually non-existent.

Generating SUIT Structure

Despite its name, by default postcss-bem will output according to SUIT syntax rather than BEM. You can output in BEM syntax, which we will cover later, but the plugin is primarily designed to output SUIT, so for that reason, we’ll start with SUIT syntax.

Generating a Component

To create a component, use the syntax @component ComponentName {...}.

Try this out by adding a SearchForm component to your “src/style.css” file:

Compile it and your resulting code should be:

Generating a Descendent

To create a descendent, use the syntax @descendent descName {...} nested inside the parent component.

Add a descendent named textField inside your SearchForm component like so:

After compiling, you should now see:

Generating a Modifier

Create a modifier to a component with the syntax @modifier name {...}, nested inside the component it effects. Modifiers should typically be placed at the top of your component, above any descendents and states.

Add a modifier named advanced to your SearchForm component with the following code:

Recompile your code and you should see your new advanced component modifier:

Generating a State

States are created via the syntax @when name {...} and can be nested inside a component or a descendent.

Add a state named invalid to your textField descendent using this code:

Now when you compile your code you’ll see it contains your new invalid state:

Namespacing Components

You can namespace your components, and all the descendents, modifiers and states nested within them, by surrounding them with @component-namespace name {...}. You can, if you like, wrap your entire stylesheet with this namespace so all your classes are automatically prefixed with it.

Try this out by wrapping all your code so far with @component-namespace mine {...}:

After compiling, you’ll see that now every one of your components is prefixed with mine-:

Generating a Utility

Utilities are created with the syntax @utility utilityName {...}. You’ll recall that when setting up your project, you installed the postcss-nested plugin. We did this as it can be very handy to use in unison with postcss-bem, as you’ll see in this example where we create a clearFix utility:

After adding the above code, compile and you’ll see this new utility has been created:

Generating BEM Structure

To activate BEM syntax output in postcss-bem, pass the option style: 'bem' in your Gulpfile or Gruntfile like so:

By default postcss-bem will use the official separator for a modifier of a single underscore _. If it’s important for your project that you use the more common separator of two dashes -- instead, you can change the config for the postcss-bem plugin by going to the node_modules/postcss-bem folder of your project, opening up index.js, locating line 15 and changing this:

...to this:

Generating a Block

Because a “block” in BEM correlates with a “component” in SUIT, use the syntax @component block-name {...} to generate a block.

To create a search-form block add this code:

Then compile and you should see:

Generating a Element

As an “element” in BEM correlates to a “descendent” in SUIT, they can be created with the syntax @descendent element-name {...} nested inside the parent block.

To create a text-field element add the following:

On compilation, you’ll see your new element has been created:

Generating a Modifier

Even though BEM allows modifiers to both blocks and elements, the postcss-bem plugin will only process them if nested inside blocks and not elements, due to the SUIT convention of modifiers being applied to components not descendents. They can be created with the syntax @modifier name {...}, nested inside its parent block.

Add an advanced modifier to your search-form component like so:

And on compilation it will yield:

No Utilities or States, but Namespaces Are In

While in BEM mode the @utility and @when syntaxes will not compile into anything, given BEM does not use utilities or states.

However, even though it’s not generally part of BEM, the @component-namespace syntax will still work if you wish to use it in your BEM stylesheet. It will prefix your classes with name--:

Let’s Recap

Now you know all about how to shortcut your BEM and SUIT development, and make the overall process more easier. Let’s summarize everything we’ve covered:

  • BEM and SUIT are class naming conventions that help to keep stylesheets function oriented and organized, as well as helping other developers recognize the purpose of various classes.
  • SUIT is like BEM, but with some extras added and adjustments made
  • The postcss-bem plugin provides shortcuts for creating BEM and SUIT classes, such as @component, @descendent, @modifier etc.
  • The plugin also allows code to be nested in a helpful way, e.g. modifiers are nested inside the component or block they modify.
  • Namespacing can be done automatically by wrapping classes with @component-namespace name {...}

In the Next Tutorial

Coming up next we look at another great way to take advantage of PostCSS, and that is by putting together a toolkit of shorthand and shortcuts we can take to make our coding faster and more efficient.

I’ll see you there!


by Kezz Bracey via Tuts+ Code

The ARK: Star Citizen Starmap

The Starmap is a public resource aiming at immersing fans into the universe of Star Citizen, Chris Roberts' crowdfunding world record-setting AAA video game project.
by via Awwwards - Sites of the day

Podcast to Book Deal: How to Turn Your Passion Into Profit

ms-podcast169-lewis-howes-560

Do you host a podcast or write a blog? Want to know what it takes to get a book deal? To discover how to turn your content into a book deal, I interview Lewis Howes. More About This Show The Social Media Marketing podcast is an on-demand talk radio show from Social Media Examiner. It’s […]

This post Podcast to Book Deal: How to Turn Your Passion Into Profit first appeared on Social Media Examiner.
Social Media Examiner - Your Guide to the Social Media Jungle


by Michael Stelzner via Social Media Examiner

White Pike Whiskey

White Pike Whiskey

Vintage-themed One Pager promoting 'White Pike' - a white whiskey, aged for only 18 minutes. The retro imagery in consistent throughout and that centrally-divided drink recipe browser is really impressive.

by Rob Hope via One Page Love

Animated Intro Section with CSS3

A collection of fancy text effects, to animate the tagline and action buttons of your website intro section.

The post Animated Intro Section with CSS3 appeared first on jQuery Rain.


by Admin via jQuery Rain

Instagram jQuery Gallery Widget : InstaShow

jQuery Instagram Gallery Widget allows creating marvelous grids of Instagram photos and sharing them in gorgeous galleries.Unleash the full power of an outstanding tool for displaying images from any public profile or any possible hashtag.

50+ adjustable elements, 10 color schemes and 16 languages will help you to create an amazing look for Instagram images. Manage the retina ready and user-friendly jQuery Instagram widget to attract your website’s audience in a flash!

The post Instagram jQuery Gallery Widget : InstaShow appeared first on jQuery Rain.


by Admin via jQuery Rain

KingTable : jQuery Administrative Table Plugin

A jQuery plugin for administrative tables that are able to build themselves, on the basis of the input data.Supports client and server side pagination; client and server side search; custom filters views; automatic menu to hide and reorder columns and support for custom tools. Client side export feature into: csv, json and xml formats.

The post KingTable : jQuery Administrative Table Plugin appeared first on jQuery Rain.


by Admin via jQuery Rain

Thursday, October 29, 2015

#ContentMarketing Tips: 10 Fundamentals Of Readable Content - #infographic

#ContentMarketing Tips: 10 Fundamentals Of Readable Content - #infographic

A huge part of being successful online is making your content easy for audiences to read. Apply these fundamentals to create readable and shareable content.

"The readability of your online content is about more than stringing together a few words into cohesive sentences. Readable content not only gets readers to stay and take action on a page, such as sharing or clicking through to your product or service, but makes it easier for search engines to find your content."

by Irfan Ahmad via Digital Information World

Growth hacking made easy with exclusive SumoMe offer

Growth hacking is one of those phrases that feels like an annoying buzzword – until you take advantage of its power and become a full-strength convert. We’ve discovered the secret of easy growth hacking thanks to our friends at SumoMe. They know how to turn a website into something epic. Over 200,000 websites use their […]

Continue reading %Growth hacking made easy with exclusive SumoMe offer%


by SitePoint Offers via SitePoint

Creating a SCRUD System Using jQuery, JSON and DataTables

Every non trivial software allows to manipulate data, generally stored in a database. The acronym SCRUD refers to the basic manipulation functions that the user needs to work with the available data: Search, Create, Read, Update and Delete.

In this article we'll create a web application which empowers the user to search a database and fully manage its content. The system is based on jQuery, JSON, and the popular DataTables and jQuery Validation plugins.

The interface of the SCRUD application

What We'll Use

In this section I'll briefly cover the libraries and plugins I'll employ in this tutorial.

jQuery and Ajax

jQuery is a free, open source and cross-platform JavaScript library which simplifies client-side HTML scripting. jQuery makes it easier to select the DOM elements and perform DOM manipulation operations, and handle events, such as mouse clicks and keyboard input. In my opinion, jQuery is the de facto standard for creating Ajax applications.

Ajax is a technique that allows you to execute HTTP requests asyncronously. This means that web applications can retrieve data from and send data to the web server without fully reloading the web page.

Continue reading %Creating a SCRUD System Using jQuery, JSON and DataTables%


by Jorrit Diepstraten via SitePoint

5 Strategies for Optimizing Advertising Infrastructure

This article was sponsored by AdButler. Thank you for supporting the sponsors who make SitePoint possible.

Online advertising is evolving, becoming more complicated than ever. Today's advertisers are looking for more effective campaigns with detailed statistics, tracking and targeting.

This new world of online advertising requires the right tools for the job. Gone are the days of simple "Ad Rotators"; today's campaigns demand the use of a full featured ad server. If you're not using one you may be leaving money on the table.

Just as airlines use advanced booking software to maximize their revenue, top publishers use third-party ad servers such as AdButler.
Here are five strategies will start you off on the right foot when it comes to optimizing your advertising infrastructure.

Strategy #1 - Experiment with Advanced Banner Concepts

The days of simple pop-ups are long gone. Much like television commercials, they go unnoticed by the vast amount of consumers because of their overuse and familiarity.

In fact, according to a 2013 study by Infolinks on the subject of banner blindness, 60% of respondents couldn’t remember the last display ad they viewed, and just 14% of respondents remembered the name of the company being advertised.

Considering the millions of dollars poured into these advertisements, that’s pretty depressing - especially if you consider that these statistics have likely only gotten worse in the two years since the study was completed.

If you want to make an impact, you’ve got to stand out from the crowd.

[author_more]

Today’s advanced banner concepts drive higher engagement levels because they offer something new that catches the consumer off guard. A few ideas to start experimenting with include:

Homepage Takeovers:

A homepage takeover is exactly what it sounds like - an arrangement for an advertiser’s banner to takeover the homepage of a brand.

Homepage takeovers(source)

Anytime you click the background image, it takes you to a link for the advertiser. These concepts require a heavy budget and immense creativity. But it’s worth trying if you think you’ve got the chops to make it work.

Roadblocks:

Want to bombard people with your message so they have no other choice than to listen? Well, then you may want to try a roadblock.

Roadblocks(source)

It’s a simple practice: buy up all the available ad space and share your message. You’ve probably seen this used before by the entertainment industry when it comes to promoting things like new movie releases.

Rich Media Applications:

These types of ads offer endless possibilities for advertisers. They’re often seen on mobile platforms as an immersive way to engage the audience.

Rich Media applications(source)

But rich media applications aren’t reserved just for mobile. They can be applied across all forms of digital media to create a great interactive experience.

AdButler has excellent support for rich media applications and other advanced tools like Video Ad Serving Templates.

Exit-Intent Pop-ups:

When someone is about to leave the page, an exit-intent pop-up grasps for the last ounce of their attention.

Exit-intent Pop-ups(source)

And they often convert pretty well too. OptiMonk, an exit-intent pop-up provider, estimates that, on an average ecommerce website, these messages can drive:

  • Sign-up rates between 3-5%
  • Sign-up rates of 10% or more when an incentive (like a free ebook, special report or coupon) is included
  • Conversion rates of 9-10% when incentives are offered

We’re working in a very dynamic era of marketing. It’s up to you to new concepts and formats to see what works best for your publishers.

Continue reading %5 Strategies for Optimizing Advertising Infrastructure%


by Aaron Agius via SitePoint