Javascript News

Syndicate content
Pipes Output
Updated: 23 hours 4 min ago

How To Get Published: The Ultimate Guide To Guest Blogging

Sa, 2015-04-18 16:00

There are a few reasons you want to position yourself as a thought leader within your industry.

Perhaps you’re trying to build your personal brand as an expert, or maybe it’s a strategy to improve traffic to your site and your business overall.

Whatever your reasons, it’s not a process that is particularly speedy, and it is one that takes work.

One of the best ways to get your voice out there and showcase your expertise is by guesting blogging.

The idea is that you write for other publications which provide a platform for you to flaunt what you know.

These days it’s not guaranteed that you’ll gain a backlink to your site since guest blogging for SEO was essentially outlawed, but there’s a good chance you will be given a link to your site and social profiles in your author bio, which will improve traffic to the listed links.

So, without further ado, let’s have a look at the steps you should be taking for guest writing success.

1. Get Started Building Your Portfolio

Long before you approach editors with a view to getting published on their site, you will need to build your own portfolio and social media accounts, according to Neil Patel. You should have your own blog, where you can publish your writing as well as social accounts to distribute your content.

You can choose a free online blogging platform such as Wordpress or Blogger, or you can add a blog section to your existing site if you sell products or services or have an online portfolio.

You can and should also use LinkedIn Publishing to increase exposure for yourself.

When creating blog posts:
  1. Research titles within your industry, paying attention to which ones do well and how much engagement they receive.
  2. Consider how you can create titles and posts that contain original ideas and industry insight.
  3. Pay attention to formatting in order to improve readability. For example, use images, bullet points and headings (H2, H3, etc.) throughout the post to make it easier to digest.
  4. Consider how the title will solve a problem for your audience. How-to articles and list posts are often very popular as these promise solutions almost immediately.
  5. Think about what call to action (CTA) you will include at the bottom of the post to prompt discussion, drive action and engagement.
  6. Find high profile blogs which you can link out to in order to add more value to the reader and to get noticed by editors.
2. Don’t Forget About Social Media.

Social media is going to be key in both distributing your content and getting it and you noticed.

As such, choose the social networks, where your audience hangs out online. Popular networks include Twitter, Facebook, LinkedIn and Google Plus. If your blog is very visual you should also include Pinterest or Instagram.

Once you’ve done this, you will need to put in a decent amount of work to increase your following.

I see a lot of people buying followers from sites that promise to give you 100,000 followers for five dollars.

Do not do this!

It is easy to be found out, and the followers that you purchase are extremely unlikely to engage with or content or provide any real value to you.

The best social followings are obtained organically and by targeting people in your niche.

Personal Tip: I’ve found that personal social media accounts gain much more engagement than business ones. 3. Research Your Target Sites.

Once you’ve populated your blog with great posts, published a few to LinkedIn and expanded your social media following, you should begin researching the publications, where you want to contribute.

You may want to aim for the top tier blogs, such as Forbes or Huffington Post, but these can be very difficult to gain entry into when you’re just beginning. Therefore aim for less well-known sites when starting out.

According to Lewis  DVorkin, chief product officer for Forbes, the site uses a mix of professional journalists and industry experts, who are all investigated by our editors and teammembers.

“We look at their experience. We look at their credentials and what they’ve done, and we turn many people away,” he said in an interview.

So unless you’ve made a big splash, it’s unlikely that you’ll have the chance to write for sites such as Forbes initially.

Instead, you should look for specific blogs within your industry such as SitePoint, which allows you to showcase your expertise through articles and tutorials.

You can find these in the design space by searching for the following terms:

  • Write for us + design (you can change the final word in different searches, e.g. Web design, web development, mobile development, UX design, etc.)
  • Contributor guidelines + your industry keyword
  • Submission guidelines + your industry keyword
  • Guest post + your industry keyword
  • Submit content + your industry keyword

The above is not an exhaustive list of the search terms that you should employ, but you get the idea. You may also use sites, such as AllTop, to find well-known, niche blogs to contribute to.

4. Research Sites’ Format and Editors.

Some websites simply provide a form where you can submit content, but most require an initial email with a few ideas and brief synopses of articles you want to contribute.

Research who the editor is for the section you wish to write for, and address them properly in the pitch email.

Editors receive a boatload of contribution requests so if you address the editor incorrectly, it’s highly unlikely you’ll ever publish on their site as long as their editor.

To editors, this lack of attention to detail, shows that you aren’t willing to put even the most minimal effort into researching the appropriate person; therefore, it is highly unlikely you will produce a well-researched and well-written piece.

Utilize sitemaps, Google and do everything that you can to find out the name of the appropriate editor and information about the publication.

Additionally, research the type of titles that do well on the site, and the format in which they write.

Most offer submission guidelines so read these through them thoroughly and ensure that you follow them.

5. Present Your Ideas.

First off, keep your introductory email short and concise.

Include a few story ideas along with a brief (two to three sentence maximum) synopsis and links to your portfolio or writing samples.

Structure your email in such a way that it is obvious to the editor that you’ve read the posts on the site and you understand what the editor wants. Here’s a good example of a successful pitch email.

Hi (Editor First Name)!

My name is (First Last Name - Link to your website or LinkedIn). I have written for publications and blogs across the U.S., and my advice has been featured in publications, such as X, Y and Z.

I want to write an article for (Publication Name)

My proposed title is: Title .

Sample Intro:

(Include a short intro to the story)

Links to my previous writing:

  • Link 1

    • Link 2
    • Link 3

    Look forward to writing for you!

    First Name =)

It’s important that you don’t write too much because a busy editor is highly unlikely to read it if it is.

Editors often have to get through a minimum of 10 to 20 or more requests per day; therefore, one that is quickly digestible is more likely to be responded to.

6. Write the Post.

Once you’ve been accepted, it’s time to write your post.

If the editor doesn’t offer a deadline date then email back to give her an expected delivery date so she can organize her calendar accordingly.

When it comes to the writing process itself, study the guidelines and stick to them rigidly.

Your post should offer fresh ideas and actionable advice that will provide a lot of key takeaways to readers.

It should be well-researched with external links to supporting information, and it should contain images or video, if available. Make sure to ask if you are required to include images or if they will worry about those details.

If you are required to source images, then it is vital graphics are being used under the Creative Commons’ license.

Some sites that allow you to search for Creative Commons’ images still require permission for you to use them so check licensing carefully.

Alyssa Gregory published a comprehensive list of free stock image sites, which you can check out here.

Include screenshots if you’re creating a tutorial to demonstrate techniques.

Your post should be easily scannable. Remember to:

  • Keep paragraphs and sentences short and concise. They should be two to three sentences long max.
  • Use bullet points
  • Utilize appropriate images
  • Ensure that there’s white space in between paragraphs
  • Check spelling and grammar thoroughly. Use tools such as Grammarly for spelling and HemingwayApp to point out overly long sentences and paragraphs and/or overuse of the passive voice.

Once you’re happy with the post, submit it to the editor and wait for feedback. Be patient, and don’t email again the very next day. The editor will get to it when she can.

If you don’t hear anything after a couple of weeks, then send a short mail asking for an update.

If the editor gets back to you requesting edits, carry these out as soon as you can, and resubmit.

7. Promote it.

Once the post is live, share it on social media and keep an eye out for comments.

Editors will be much more inclined to let you submit another post if you get involved in the community and answer any comments that are left on the post.

Encourage engagement on social media by creating “Tweetables” that persuade your followers to click through, read it and share.

For example, this post “Tweetables” might read:

  • How To Get Published: The Ultimate Guide - Tell us how you’ve gotten published in the article’s comments.
  • Do you make these email mistakes? It may be the reason editors aren’t publishing your content.

By including a CTA, you’re encouraging your audience to get involved as well as prompting others to read.

Get creative here, and it will ridiculously boost your post’s engagement.

Use scheduling software, such as Buffer, to share the post on social when you’re not around to drive even more engagement. But also ensure that you’re combing through replies and thanking people for sharing, liking and commenting.

8. Rinse and Repeat.

Once your first post is out there, your site’s traffic will gradually increase. Remember though, it’s not an overnight process, and you will have to consistently publish more posts before you can begin to call yourself a thought leader or influencer.

If you consistently put the work in, ensuring you also get involved in discussion on various forums then you will see results.

Keep in mind, Rome wasn’t built in a day.

Get yourself out there as much as possible, by commenting on industry blogs and/or the following places:

  • Industry Discussion Groups on LinkedIn
  • Quora
  • Reddit
  • Google Plus communities
  • Facebook industry groups

Continue reading %How To Get Published: The Ultimate Guide To Guest Blogging%

Extending HTML the Way

Fr, 2015-04-17 18:00

Teaching the old dog HTML new tricks is a major focus of today’s modern JavaScript frameworks. Be it by following potential standards like WebComponents, creating custom Directives or by extending existing classes, chances are high that your framework of choice provides a means to extend HTML’s markup itself. In the first article of this series you were introduced to the new player: Aurelia. This follow up will show you how to create custom elements as well as custom attributes by following Aurelia’s conventions.

The complete code for this article can be found on our GitHub repo and you can see a demo of what we are going to build here (please allow some time for the app to initialize).

Why the Need for More Markup?

Before jumping straight into the action let’s first understand the potential use case for creating new components. To do so we will take a conceptual look at the introductory example as shown in the figure below. We have two pages, represented by a ViewModel (VM) and a View, showing funny pictures and gif videos. Each of those has a repeated list which itself renders posts containing an image and a text block.

Aurelia Reddit Client conceptual diagram

By looking at the View we can see that data acquisition, as well as rendering, is tightly coupled in one VM/View pair.

[code language="html"] [/code]

This might not be a problem with a simple example, but can turn into a major drawback as the system grows and more and more requirements are gathered.

Enhancing Existing Elements with Custom Attributes

Imagine we get a request to provide a popover for each of the funny pages posts. In order to do that we could easily wire up Bootstrap’s feature directly into the markup by placing the necessary data- attributes followed by an initialization inside our FunnyVM. But what if we suddenly need to do it on the other page as well? Providing the feature by declaring a custom attribute can make our lives much easier. These are particularly useful in following scenarios:

  • Wrapping existing plugins
  • Shortcuts for common bindings such as style or class
  • Altering existing HTML elements / custom elements without direct code access

Now let’s get our hands dirty and see what it takes to build our first custom attribute.

Creating the popover

Let’s start by looking at what we’d like to achieve. The new attribute popover should accept parameters for the placement, title and content of the popover. The placement is fixed to the right, so a simple string as value is enough. For the other two properties we’re going to use Aurelia’s data binding to map the iterated values. In order to load the file we make use of Aurelia’s require feature. The from attribute contains the relative path to the resource to be imported.

[code language="html"] ... [/code]

In order to make that happen, we start by creating a new JavaScript file in the src folder called popover.js. The custom attribute, like all other Aurelia constructs, is a simple exported ES6 class rather than a collection of functions passed into a predefined API (as many legacy frameworks do).

[code language="js"] import {customAttribute, bindable, inject} from 'aurelia-framework'; import $ from 'bootstrap'; import bootstrap from 'bootstrap'; ... [/code]

Compared to other frameworks, Aurelia declares constructs by describing them via metadata. But instead of using static functions or complicated APIs, Aurelia leverages cutting edge ES7 Decorators to achieve that. We’re going to import the necessary decorators from the package aurelia-framework. As for the control itself, we will use the Popover JavaScript control provided by Twitter Bootstrap. So we import the jQuery handle $ as well as bootstrap in order to initialize Bootstraps’ JavaScript code.

The next step is to apply the previously mentioned metadata so that Aurelia knows what it gets when it loads the file. By attaching the customAttribute decorator we name our component with the given value. The bindable decorator on the other hand is declaring a property which our View can bind to. We simply repeat this decorator for each available property.

[code language="js"] @inject(Element) @customAttribute('popover') @bindable('title') @bindable('content') @bindable('placement') export class Popover { ... [/code]

Continue reading %Extending HTML the Way%

On Our Radar: teaching and learning from web devs

Fr, 2015-04-17 17:00

Hello everybody and welcome to this week’s On Our Radar. It’s been a long week, thwarted by my recent understanding that the beginning of a programmer’s wisdom is knowing the difference between getting a program to run, and actually having a runnable program. On Our Radar: That really seems to be at the heart of […]

Continue reading %On Our Radar: teaching and learning from web devs%

Virtual Environments in Python Made Easy

Fr, 2015-04-17 16:00

Most Python newcomers don’t know how to set up a development environment that follows the latest standards used by professional programmers, so this tutorial will teach you how to properly create a fully working Python development environment using industry accepted best practices.

Virtual Environments

There are so many libraries I use for my own personal projects, three web application development frameworks I use and many others I would love to explore in the near future. It is very clear that a serious project in Python depends on other packages written by other developers. If you are a Django developer, I am very sure you make use of South for performing automatic database migrations, Django Debug Toolbar for gathering various debug information about the current request/response, Celery for taking care of real-time operations and scheduling as well, and so on.

Continue reading %Virtual Environments in Python Made Easy%

Using BoltCMS to Build a Small Business Website

Fr, 2015-04-17 16:00

As the web continues to mature and the demand for the efficiency of content delivery increases, more and more slim and trim CMSs are coming into the fray. Developers (front-end and back-end) are branching away from the heavy-hitters like WordPress and Drupal, and into the likes of more streamlined, tailor-made solutions. Bolt CMS is one of these CMSs, and prides itself on being a dream for designers, developers, and content editors alike.

On the front-end side of things, Bolt uses the increasingly popular Twig templating language, allowing front-end devs to quickly and neatly generate templates the way they want, and how they want. On the back-end side of things, custom types and fields give us the freedom to organise things the way we want. Bolt is also built upon Silex with Symfony components, making it stable, powerful, open source, and free. Twig, Silex, and Symfony are all under the Sensio Labs umbrella, so you’re guaranteed one will never leave the other in the dust. It’s a great combination!

Bolt has a really nicely laid out documentation on their site, as well as a Stack Overflow tag with an increasing number of posts. Other ways to raise points or get support include the GitHub issue tracker. Read up on the community page for more info.

Building With Bolt

In this article, we’re going to take a look at the following key points which should set us up nicely for building our first project with Bolt:

  1. Requirements, setup and installation
  2. Main configuration and theme set up
  3. Splitting up files into templates
  4. Introducing and creating content types
  5. Retrieving content from database records

From now on, I recommend you keep the docs open in your browser, because we’ll reference it a lot. Alright, let’s dig in!

Continue reading %Using BoltCMS to Build a Small Business Website%

New Web Layout Ideas for 2015

Fr, 2015-04-17 07:37

Every year new web design concepts emerge as some older trends recede. In the next months we will no doubt see a temporary increase in the popularity of video backgrounds, tiles and animated storybooks, just to name a few.

On the other hand, it's almost guaranteed that responsive web design, a trend that surfaced back in 2010, will remain at the core of our designs for the foreseeable future.

Of course, this doesn't mean that all web pages have to move towards a common and standardized structure. On the contrary, there will likely be more space for differentiation, flexibility and experimentation than ever before.

We have identified four trends, or general schemes, that we believe will characterize layout design in the next year. You can take inspiration from these models but the best design often comes when you use inspiration as a jumping off point for your ideas.

So, here are the trends.

The Split Screen

By "split screen" we mean all those websites where the screen is divided in two parts, usually of the same size, by a vertical section.

There are two main reasons to divide the page this way:

  1. To show two important characteristics.
  2. To express the idea of duality.

The first situation often occurs when a company has to promote a product or a service which has two equally significant features or variants. Since websites generally display elements stacked in order of importance, a more traditional layout may not be suitable in this case.

On the other hand, dividing the screen in two equal columns may be the best way to showcase two different aspects of the same system -- for instance, a publishing system that is advantageous to both publishers and readers.

In this way, there is no need to distinguish between a primary and a secondary characteristic and the readers will immediately focus on what is important.

The second reason originates from the fact that sometimes, designers need to convey an idea of duality. In this case, dividing the screen in two parts creates two spaces where it is possible to concentrate on different topics or even on two different products. Also, this style makes you able to highlight opposite traits of a certain reality.


The first example we are going to see is represented by the homepage of Desktime, a company which operates in the office-sharing sector. They've cleaved the page in two in order to simultaneously satisfy the needs of those who already have an office, for and of those who are looking for one.

Therefore, they used the "vertical split" to put give equal stage time to two equally important features in their service. The style they have adopted is effective and practical, and it is also very linear and simple. Well done!

Note: Eight&Four has redesigned since I wrote took this screenshot.


This second example is from Eight&Four, a digital marketing company. Their homepage is also divided in two and the design is based on the contrast between white and a flat color. The division here is used to express a series of different features which are all present in the company.

The "vertical split" style is also hinged by the presence of the "&" which attenuates the division.

Container-Free Layouts

Almost since design began designers have been using elements such as boxes, shapes and lines to divide and contain content in a design. As an example, consider how headers or footers have always been designed to be visually separated from the rest of the content.

A new trend is gaining popularity centered around the idea of removing any graphic structure in favor of a more free and open style.

This trend has some common traits with minimalism but it also goes a step further. Indeed, minimalism often still uses simple, linear structures, while this new "container-less" completely strips any visual packaging.

Content itself is put at the center of the attention and the hierarchy of information is given by the choice of color, by positioning and by thoughtful typography rather than by boxes and structure.


As you can see from the homepage, Foreword is an interactive agency which is based in New York and in Paris. Their website does away with any containing elements and the attention of the users is here focalized by colors and fonts.

In particular, they use typography wisely to give the most important company information. Color is prominently used to highlight other clickable voices. It is also obvious that this website, aside from being responsive in every sense, is extremely minimal.

Invisible Grids

We don't need to point out here that grid structures can be a very effective way to create responsive websites. In this case, every module will contain a particular piece of content such as a heading, an image or a text.

Modules are typically used in the homepage of websites but they can be developed in every other page to satisfy the need.

The dimensions of each module is designed to be flexible and it will adapt to the screen size. This makes a robust "grid layout" is a very versatile tool and it can equally usefully used for websites as well as mobile applications.

However, one of the challenges of this approach is that if you create many modules of the same size, it can be difficult to create a distinction between the most interesting material and the older, and less important items.

Indeed, if many blocks are of uniform size, the user's attention may not be grabbed by any item in particular. To avoid this problem, one new approach is to create modules which have different dimensions according to what they contain.

Note: Greats have also redesigned since I took this screenshot.


Greats is a New York based company which sells men's footwear, mainly via their website. Their website is their showcase, thus every detail is studied and taken in high consideration.

"Greats" opted for the utility of a grid layout. They've stacked their homepage with rows of modules and each module contains a pair of shoes. The modules all have similar sizes and their shape is implied rather than strictly marked out. Indeed, the user is encouraged to ignore anything other than the parade of shoes.

Continue reading %New Web Layout Ideas for 2015%

Thinking Outside the DOM: Composed Validators and Data Collection

Do, 2015-04-16 20:00

In part 1 of this mini-series, we discussed a problem common to many validation libraries: tightly coupled code. Then, I introduced you to the benefits of separating orthogonal concerns. As a proof of concept, we started the development of a form validation system that is not restricted to forms, and can even work outside the DOM altogether. In this second and last part, we'll discuss composed validators, how to collect data from a form, and how to report errors. Finally, I'll provide you a link to the GitHub repository containing all the code developed in this mini-series. Composed Validators In the previous article we developed a system for validating individual fields. Validating fields one-by-one with one rule at a time is fine and dandy, but there are many cases that require some more thought. You can validate an email address with one insanely long regular expression, but doing so will only enable you to tell your users whether the email is acceptable or not. A better approach is to validate several parts of the email address separately and provide a targeted email validation error. This is possible with the current design:

Continue reading %Thinking Outside the DOM: Composed Validators and Data Collection%

Boost Your WordPress Capabilities with These Top Plugins

Do, 2015-04-16 19:10

WordPress is a favorite of web professionals and novices to website development alike because of its ease of use. The wide array of plugins ensures that you're able to find pre-made tools for common administrative tasks.

Unfortunately, many of the plugins listed on the WordPress Plugin Directory overlap with each other in functionality. Need a contact form? Running a query on that topic yields 775,000 results. How about SEO? You’ll get 802,000 results.

Fortunately, choosing the right plugins for your site is easier thanks to an article from The article provides readers with a listing of the most popular WordPress plugins being used on the Alexa top 500K sites. We've also covered the most popular WordPress plugins by number of downloads in a previous article on SitePoint, the results are similar to what's listed on the HackerTarget article.

Below is a summary of the top plugins broken down by category so you can make an informed decision when adding content to your website.

Continue reading %Boost Your WordPress Capabilities with These Top Plugins%

Responsive Data Tables: A Comprehensive List of Solutions

Do, 2015-04-16 18:00

Tables are an important part of HTML. Although they were often used in the past for layout, today they’re mainly used for marking up data. Since the adoption of responsive web design, various approaches have been developed for establishing tables that can scale well in different viewport sizes.

In this article, I’ll go over and analyze many of these approaches. Keep in mind that I’ll be focused mostly on the JavaScript-based ones, as I think they offer more options and features compared to the pure CSS solutions. To make things easier and clearer, this article is full of helpful images and demos.

The Basic Markup for Our Table

Before diving into the core methods, let’s have a look at the example table that will be used throughout this article to demonstrate the different methods for achieving responsive tables:

[code language="html"] Example Table Caption Country Languages Population Median Age Area (Km²) Argentina [/code]

Note that with the exception of the Foundation example, the styling of this table will be based on Bootstrap’s table styles.

Let’s now get familiar with different techniques for building responsive tables.

Bootstrap’s Responsive Tables

To create a responsive table with Bootstrap, you have to wrap the table inside a div element with a class of table-responsive. By default, Bootstrap applies the overflow-x: auto property to this wrapper element. When the browser window is less than 768px, the overflow-y: hidden property is applied. Therefore, on small devices you can see the contents of your tables by scrolling horizontally.

The following screenshot demonstrates what’s described above:

Continue reading %Responsive Data Tables: A Comprehensive List of Solutions%

Using Closure Space to Create Real Private Members in JavaScript

Do, 2015-04-16 17:00

This article is part of a web dev tech series from Microsoft. Thank you for supporting the partners who make SitePoint possible.

I recently developed Angular Cloud Data Connector, which enables Angular developers to use cloud data, specifically Azure mobile service, using web standards like indexed DB. I was trying to create a way for JavaScript developers to embed private members into an object. My technique for this specific case is to use what I call “closure space”. In this tutorial, I want to share with you how to use this for your own projects and how performance and memory are impacted for the major browsers.

But before diving into it, let me share why you may need private members, as well as an alternate way to “simulate” private members.

Feel free to ping me on twitter if you want to discuss this article.

Why use private members

When you create an object using JavaScript, you can define value members. If you want to control read/write access on them, you need accessors that can be defined like this:

[code language="js"] var entity = {}; entity._property = "hello world"; Object.defineProperty(entity, "property", { get: function () { return this._property; }, set: function (value) { this._property = value; }, enumerable: true, configurable: true }); [/code]

Doing this, you have full control over read and write operations. The problem is that the _property member is still accessible and can be modified directly.

This is exactly why you need a more robust way to define private members that can only be accessed by object’s functions.

Using closure space

The solution is to use closure space. This memory space is built for you by the browser each time an inner function has access to variables from the scope of an outer function. This can be tricky sometimes, but for our topic this is a perfect solution.

So let’s alter the previous code to use this feature:

[code language="js"] var createProperty = function (obj, prop, currentValue) { Object.defineProperty(obj, prop, { get: function () { return currentValue; }, set: function (value) { currentValue = value; }, enumerable: true, configurable: true }); } var entity = {}; var myVar = "hello world"; createProperty(entity, "property", myVar); [/code]

In this example, the createProperty function has a currentValue variable that get and set functions can see. This variable is going to be saved in the closure space of get and set functions. Only these two functions can now see and update the currentValue variable! Mission accomplished!

The only caveat we have here is that the source value (myVar) is still accessible. So here comes another version for even more robust protection:

[code language="js"] var createProperty = function (obj, prop) { var currentValue = obj[prop]; Object.defineProperty(obj, prop, { get: function () { return currentValue; }, set: function (value) { currentValue = value; }, enumerable: true, configurable: true }); } var entity = { property: "hello world" }; createProperty(entity, "property"); [/code]

Using this method, even the source value is destructed. So mission fully accomplished!

Performance Considerations

Let’s now have a look at performance.

Obviously, closure spaces or even properties are slower and more expensive than just a plain variable. That’s why this article focuses more on the difference between regular way and closure space technique.

Continue reading %Using Closure Space to Create Real Private Members in JavaScript%

The Dos and Don’ts of Relationship Marketing

Do, 2015-04-16 16:00

A popular Reddit thread had users discussing how different companies had forever won their business.

One of the top posts was about the outdoor apparel company MooseJaw.

The Redditor described how his roommate had ordered a hoodie from MooseJaw as a Christmas present for his girlfriend. Then, a few weeks before Christmas, she broke up with him.

The roommate sent the hoodie back to MooseJaw for a refund, and in the “reason for returning” column, he wrote “girlfriend dumped me.”

Three weeks later he received a large package from MooseJaw.

Inside was a selection of t-shirts and MooseJaw stickers. There was also a card that read, “We're sorry your girlfriend broke up with you, we decided to give you a gift."

The rest of the card was filled with notes and jokes from MooseJaw staff members.

This is an example of a relationship marketing investment at its finest.

In relationship marketing, the explicit goal is not to land a transaction, it’s to foster customer loyalty and long-term engagement. But relationship marketing is a tricky business.

A handwritten note, for example, can be seen as sincere and exclusive, as was the case in the above example. But if MooseJaw had ignored the context of the returned hoodie and had instead sent the customer a generic note expressing their apologies for the unwanted product, the move might have come across as disingenuous.

Getting relationship marketing right requires an extra level of empathy and awareness.

When you’re broadcasting to a large group of people, there is no expectation of personalization.

You can be more generic with your message, more sweeping with your statements. But when you zoom in on one person, there are expectations, and those expectations are high.

Here are some dos and don'ts of relationship marketing.

Do: Focus on Free Will Investments Over Contractually Obligated Ones

Ah, free will. It may not vibe in the Garden of Eden, but it’s a hot commodity in relationship marketing.

“When customers perceive relationship marketing (RM) investments as an act of free will, they feel more grateful than when they perceive the actions as duty-based obligations or contractual requirements,” writes Robert Palmatier et al. in “The Role of Customer Gratitude in Relationship Marketing.”

In the MooseJaw example, the company sent the customer a gift under no obligation.

The action would not have been as effective if the gift had been, for example, part of a loyalty program.

While loyalty programs are a smart way of retaining customers, they don’t inspire the same gratitude in the customer as a spontaneous gift.

This is because a loyalty program is a contractual obligation, and doesn’t reflect the same thoughtfulness as an investment made out of free will.

Furthermore, a customer will value a relationship marketing investment less if:

  • It’s something that everyone receives.
  • It’s a response to a customer request.
  • It’s only given to match a competing offer.
  • It comes standard with the product or service.

This is not to say that any of the above investments should be done away with. They are, of course, integral to any respectable business, but as relationship marketing tools, they are not as effective as free will investments.

Don’t: Wait To Provide An Opportunity For The Customer To Reciprocate

It doesn’t matter if a company sends a birthday card or a year’s worth of free skydiving lessons, in time, the customer’s gratitude will decay.

In the worst case scenario, a customer may eventually “generate feelings of guilt, which customers may try to relieve by rationalizing why they did not reciprocate,” Robert Palmatier et al. writes.

To take advantage of their gratitude when it’s at its highest level, companies should provide customers with the opportunity to reciprocate (time-sensitive discount, new product/service reminder) soon after those skydiving tickets arrive in the mail.

But like everything else, this must be done with tact. If a company consistently surprises a customer with a gift or a favor, only to immediately follow it up by announcing a new opportunity, the investment will lose its sincerity, and be viewed as just another marketing ploy.

Do: Play It Safe Unless You Really Know The Customer

Maybe you’ve heard this story, or a variation thereof.

A company wants to thank a client for her continued business.

Rather than write a card or give the client a discount, the company sends the client a nice bottle of wine. It turns out that the client is a recovering alcoholic. He takes his business elsewhere.

This is an extreme example, but it speaks to the larger issue.

When trying to foster loyalty, you wouldn’t send an alcoholic a bottle of wine any more than you would send an avid golf player tickets to a basketball game. At face value it’s a nice gesture, but it doesn’t show the client that they’re appreciated, it shows them that they’re a stranger.

If a company wants to step outside of the box and forgo the traditional birthday card in favor of something more personal, they first need to make sure that it is truly personal. Put in the small amount effort it takes to learn a little something about the customer.

It really isn’t that difficult.

A quick browse of someone’s Twitter or Facebook can provide a year’s worth of gift ideas.

A simple conversation that ventures slightly out of standard business territory can yield worthy insight into a customer’s personal life.

“What did you do over the weekend?”

“I went fishing.”

“You like to fish?”


Now you know what to get them. Fishing stuff.

And unless the client specifically tells you that they currently drink alcohol, refrain from sending it as a gift. Just in case.

Don’t: Make An Investment That’s Irrelevant To The Customer’s Situation and Needs

The MooseJaw customer didn’t necessarily need the free shirts and stickers.

What he needed was compassion for his situation.

MooseJaw understood that, and their box of goodies was secondary to the gesture itself.

Without the note expressing MooseJaw’s sympathy, the investment would not have had the same impact.

The guy’s girlfriend broke up with him. What are a few shirts going to do?

“The customer’s perceived need for the received benefit should affect his or her gratitude,” according to Robert Palmatier et al.

A great example of a relevant relationship marketing investment belongs to the Gaylord Opryland hotel in Nashville.

One of their customers, Christina McMenemy, became enamored with an alarm clock in her hotel room, which played the kind of light music you would find in a spa.

She wanted one of her own, but couldn’t find it available anywhere online.

So she reached out to the hotel via Twitter and was told that their alarm clocks were not available to the public.

McMenemy was about to give up the search when she returned to her hotel room and found two alarm clocks and a handwritten letter. It said they were for her to keep.

McMenemy’s response was what every relationship marketing investment should hope to achieve.

She said that Gaylord Opryland “reaffirmed that there are still companies out there focused on great service, and you’ve made a lifelong fan out of me.”

A lifelong fan. That’s the dream.

Continue reading %The Dos and Don’ts of Relationship Marketing%

Sass Theming with Configuration Files

Do, 2015-04-16 14:00

For well over the last year or so I’ve been working on a large scale project with multiple websites based on the same codebase. All of these sites require the same core functionality but at times differed with extra features or unique styles. When it came to styling, the main issue we found was the need for certain sites to have an entirely different theme to the others. Because of this we decided to use Sass to create the CSS for the sites. In this article I want to talk you through how we went about editing themes for the various, different sites.

To give a brief bit of context, the project is using WordPress with a parent/child theme structure. There is a core parent WordPress theme with all the main functionality that each site would use, along with child themes for each of the different market sites.

Configuring your Sass

To start with I want to take a brief look at how we typically use configuration files in our Sass. Below is a basic folder structure for one of our projects:

Continue reading %Sass Theming with Configuration Files%

RethinkDB in Ruby: Map Reduce and Joins

Do, 2015-04-16 13:30

Last time around we covered some of the basics of RethinkDB: installing it, querying it, inserting documents - all with the Ruby driver. In this article, we'll take a deeper look at some of the features of RethinkDB. Before we get started, you should have a copy of RethinkDB installed and running.


Say we have a bunch of data spread across a group of nodes. We're trying to run some kind of computation on this data; how should we do it? One obvious solution (that's also obviously bad) is trying to move all the data to one node where an algorithm is run in order to get the information we need. There are many reasons why this is a horrible idea:

  • We might not have enough storage on the single node
  • It would take a lot of bandwidth, etc.

So, how do we take advantage of all these nodes? Well, write the algorithm so that it can run in a parallelized fashion across the cluster. Unfortunately, without any "guidelines", this can be a pretty difficult task. For example, what if one of the nodes fails while we're running our algorithm? How do we divide up the dataset so that all the nodes pull their own weight?

Back in the day, when researchers/developers at Google came across these problems, they developed a framework called MapReduce. Essentially, MapReduce forces you to structure your algorithm in a certain way and, in return, it can handle system failures, etc. for you. With MapReduce, your code remains unchanged regardless of whether it's running on one node or a thousand. It turns out that RethinkDB includes an implementation of MapReduce that allows you to apply computations to your data set in an efficient way.

So, how does MapReduce work? Say we're trying to operate on many pieces of data and we put them all in a list. The MapReduce paradigm consists of two steps (RethinkDB introduces a separate step called grouping which we'll discuss later): map and reduce. Map, just like the map Ruby method, takes a list, operates on it, and then spits out another list. Reduce, just like reduce in Ruby, takes a list and "boils" it down a value. If you write your algorithm using these "map" and "reduce" pieces, RethinkDB will figure out how to efficiently split up the computation (over tables and shards).

Continue reading %RethinkDB in Ruby: Map Reduce and Joins%

Introduction to inuitcss: A Different Kind of CSS Framework

Mi, 2015-04-15 23:00

In the last few years there has been a rise in the use of front-end frameworks. These tools, such as Bootstrap and Foundation, allow developers create web sites and apps quickly. Instead of needing to style up your own buttons and nav bars these frameworks do all of the heavy lifting for you.

The problem with these frameworks is that we are forced to download huge stylesheets and we often aren’t even using the majority of the features of the framework. But wouldn’t it be great if we could pick and choose what modules we wanted to use?

Introducing inuitcss

inuitcss is a Sass-based framework created by Harry Roberts . The beauty of inuitcss is that it’s what you make of it. Instead of a central code base inuitcss consists of a set of independent modules. Instead of including a bunch of modules that we will never use, inuitCSS lets us piece together our own architecture.

Unlike other frameworks, inuitcss does not provide you with many UI elements. Often when using a framework we are taking existing components and tweaking them to our liking. Inuitcss rejects this approach in favor of allowing you to make your own design choices.

Installing inuitcss

We can download and import the modules that make up inuitcss manually, but the simpler option is to use Bower or NPM. Bower and npm are package managers that manage dependencies and scaffold projects for you. Since both are based on Node.js you’ll need to install Node.js first.

We can use Bower to create a new project with all intuitcss dependencies installed. We can also use it to initialize an existing project.

Installing and Using Bower

After you install Node.js, open up a command prompt and type:

[code language="bash"] npm install -g bower [/code]

That simple and you have installed Bower. If you have an existing project you can now use Bower to add inuitcss. Navigate to your project folder and run:

[code language="bash"] bower init [/code]

This creates a bower_components directory. To manually import individual modules, use the following command:

[code language="bash"] bower install --save inuit-(module-name) [/code]

For example, to import the inuitcss layout module we would use:

[code language="bash"] bower install --save inuit-layout [/code]

This installs the module in the bower_components directory. As an alternative, we can use the inuitcss starter kit to scaffold a new project or add to our existing project.

Continue reading %Introduction to inuitcss: A Different Kind of CSS Framework%

The 2015 Stack Overflow Developer Survey

Mi, 2015-04-15 22:00

If you're reading this, you're probably a male developer in your late twenties who's been doing the job for up to five years. You taught yourself to program, use a Windows PC with Notepad++ and class yourself as a full-stack developer. You use Git and JavaScript frequently and drink two cups of coffee per day. That's the profile of the average Stack Overflow developer from their 45-question 2015 survey. It received 26,086 responses from technically-minded people in 157 countries. Let's look at the results in more detail… Developers, Developers, Developers How many developers are there in your country? The highest is Luxembourg with 39.8 developers per 1,000 people (perhaps you know someone who's a 0.8!) Several Scandinavian countries come second with 35 developers per 1,000 while Somalia, Chad and North Korea have the fewest. The average developer is 28.9 years old. They tend to be a little older in Western countries and younger in developing countries: 31.6 for the US compared to 25 for India. Depressingly, 92.1% of us are male. Development has a gender balance problem but I doubt it would reach 50-50 even if discrimination were not a factor.

Continue reading %The 2015 Stack Overflow Developer Survey%

Creating a Next Gen JavaScript Application with Aurelia

Mi, 2015-04-15 20:00

2015 brings with it the finalization of the ECMAScript 6 specification and with that the confidence to build modern, superior applications in JavaScript. The current landscape of JavaScript frameworks is dominated by the recognizable giants AngularJS and React both of which are aiming in some way, shape or form, to incorporate new ES6 features into their paradigms. There is however, another player that while new and relatively secretive, looks elegant in its use of modern JavaScript features. I'd like to take a moment to introduce you to Aurelia. Aureli-who? Aurelia is a next generation framework that leverages modern concepts like ES6, Web Components, and modularization to help you develop performant, futureproof applications. Aurelia is the natural progression of Durandal, an AngularJS competitor built by Rob Eisenberg. Aurelia's history involves a number of encounters with the AngularJS team over the years. It's for this reason that many aspects of the framework might feel familiar to the AngularJS developers among you. New Technologies As I said, Aurelia is a "next generation" framework and as a consequence the tools it uses may be new to some of you. It runs on Node.js, and uses npm but it relies on a few cool new pieces of tech that we'll look at briefly below: Gulp This one isn't so new but it's a core part of Aurelia's setup. We'll use Gulp to pipe all our files through various tasks to ensure our application is all wired up and ready to go. ES6 Module Loader Polyfill The ES6 module loader is a pollyfill for the System dynamic module loader that was part of the original ES6 specification. The System loader is in the process of being written into browser specifications but in the meantime this polyfill provides a futureproof solution that we can use today.

Continue reading %Creating a Next Gen JavaScript Application with Aurelia%

2-Step Verification for WordPress Using Google Authenticator

Mi, 2015-04-15 19:00

Online security is a big issue. Thousands of websites, brands, and online accounts are attacked by hackers every day. With the use of WordPress being so widespread, it's not immune to these attacks. Thousands of WordPress powered websites have been targeted successfully in the past.

The infamous default 'admin' username and a weak password are both big issues, since they're easier to brute force. It's highly recommended that you never use 'admin' as your primary username, and always use a strong password, rather than a common, easy to remember password.

Google's 2-Step Verification

Normally, you need a username and password to log in to your WordPress dashboard. If you use a strong password, that's a step in the right direction, but did you know that you can make your WordPress login even more secure with Google's 2-Step Verification (also known as two-factor authentication)?

There are numerous two-factor authentication plugins. In this article, I'm only focusing on Google Authenticator, which is already widely supported by many providers for two-factor authentication.

With Google's 2-Step Verification enabled, you'll be prompted to enter a six-digit number after you provide your username and password. If you don't provide this six-digit number, you won't be able to log in, even if you have the correct username and password.

Google's 2-Step Verification can make your WordPress website more secure and more hardened against brute force attacks; even if your username password becomes compromised, logging in to your website will not be possible without the six-digit code.

Continue reading %2-Step Verification for WordPress Using Google Authenticator%

3 Things (Almost) No One Knows About CSS

Mi, 2015-04-15 18:00

Think you know CSS? If the results of a free CSS test I’ve offered online for the past six months are anything to go on, plenty of practicing developers don’t know CSS as well as they think. Out of over 3,000 people who have taken the test so far, the average score was just 55%.

But hey, an average isn’t that interesting by itself. I was more curious about which questions people were getting wrong. For this article, I’ve run the numbers, and zeroed in on three questions where people scored especially badly. I’ll talk you through each question, show you the answer that most people chose, and explain the correct answer.

It’s safe to say that if you take the test yourself after reading this, you’ll have an unfair advantage!

Question 1: How Best to Set line-height

This first question should have been easy for anyone who deals with text styles on a regular basis:

You want text on your website to be double-spaced by default. Which of the following line-height values is the best way to achieve this?

  • 200%
  • 2em
  • 2
  • double

With four answers to choose from, you’d expect 25% of people to get the right answer by luck alone, and only 31% got this one right! Take a minute and pick out an answer for yourself, then read on.

First off, double is a red herring. The only keyword value that line-height accepts is normal. I’m happy to say that only 9% of people fell for this one. The remaining three answers were all pretty popular, though.

The answer that most people selected is 2em (39% chose this). Indeed, 2em will certainly give you double-spaced text for the element it’s applied to; but so will 200%, and only 21% liked that answer! Either ems are much more in fashion than percentages, or people don’t really understand them.

Continue reading %3 Things (Almost) No One Knows About CSS%

Improve JavaScript Performance Analysis Results with User Marks

Mi, 2015-04-15 17:00

This article is part of a web dev tech series from Microsoft. Thank you for supporting the partners who make SitePoint possible.

When working on advanced JavaScript code, like a 3D engine, you may ask yourself what you can do to optimize performance, and how much time you should spend working on specific pieces of code. In this tutorial, I'll share several tools that provide insight into how your code is performing, and show you how to make the most of user marks in the memory graph to analyze your performance.

Can’t wait to see what this article is about? Watch this video.

Feel free to ping me on Twitter if you want to discuss this article!

Need a profiler?

One that comes to mind is the integrated profiler you can find using the new updates to the Internet Explorer F12 Dev Tools, enhancements that will also be available for Project Spartan. Of course, you can use any similar tools you prefer too on your dev box. If you want to try this out on Android, iOS, or Mac OS, you can also use remote.IE to get an instance of Windows 10 Technical preview running in minutes. Then open the Internet Explorer “e” you’ve been avoiding (it is a temporary client shell that has Project Spartan’s new rendering engine configured), hit “F12” and now you can see what I’ll show you:

Please note that with the new F12 tools that we shipped with Windows 10 Technical preview, profiler is now part of the UI responsiveness window:

Let’s see other options that can give you more insights about how your code is performing.


You just have to call console.time() and console.timeEnd() around the piece of code you want to evaluate. The result is a string in your console displaying the time elapsed between time and timeEnd.

This is pretty basic and can be easily emulated but I found this function really straightforward to use.

Even more interesting, you can specify a string to get a label for your measurement.

This is for instance what I did for Babylon.js:

[code language="js"] console.time("Active meshes evaluation"); this._evaluateActiveMeshes(); console.timeEnd("Active meshes evaluation"); [/code]

This kind of code can be found around all major features and then, when performance logging is enabled, you can get really great info:

Be warned that rendering text into the console can consume CPU power

Even though this function is not standard, browser compatibility is pretty great, with Chrome, Firefox, IE, Opera and Safari all supporting it.

Performance object

If you want something more visual, you can use the performance object as well. Among other interesting features to help you measure a web page’s performance, you can find a function called mark that can emit an user mark.

A user mark is the association of a name with a time value. You can measure portions of code with this API in order to get precise values. You can find a great article about this API by Aurelio de Rosa on SitePoint.

The idea today is to use this API to visualize specific user marks on the UI Responsiveness screen:

This tool allows you to capture a session and analyze how CPU is used:

We can then zoom on a specific frame by selecting an entry called Animation frame callback and right-clicking on it to select filter to event.

The selected frame will be filtered then:

Thanks to the new F12 tool, you can then switch to JavaScript call stacks to get more details about what happened during this event:

The main problem here is that it is not easy to get how code is dispatched during the event.

This is where user marks enter the game. We can add our own markers and then be able to decompose a frame and see which feature is the most expensive and so on.

Continue reading %Improve JavaScript Performance Analysis Results with User Marks%

Social Logins in PHP with HybridAuth

Mi, 2015-04-15 16:00

A trend in many of today’s websites is a feature that allows users to sign in via their social network accounts. A classic example is the SitePoint community where users have the option to use their Facebook, Twitter, Google, Yahoo or GitHub account to log in without having to register an account.

In this tutorial, we will be learning about HybridAuth - a PHP library that takes the pain out of building a social login feature.

HybridAuth acts as an abstract API between your application and the various social APIs and identity providers.


The recommended way to install HybridAuth is via Composer. We’ll also use Slim as a foundation for our sample app.

{ "require": { "slim/slim": "2.*", "hybridauth/hybridauth": "2.3.0" } } Using HybridAuth for Social Logins

To use HybridAuth, copy the config.php and index.php (HybridAuth Endpoint) files in /vendor/hybridauth/hybridauth/hybridauth to your project’s root folder.

Rename the index.php file to hybrid.php because index.php will be used by Slim framework for our demo application logic.

Populate the config.php file with your application’s (e.g. Facebook, Twitter application) credentials.

For example, If you want users to sign in to your website via Facebook, Google, and Twitter; your config file would look pretty much like this. My application URL is http://slim.local.

Continue reading %Social Logins in PHP with HybridAuth%