Wednesday, January 27, 2016

Creating Amazing Projects with a $5 Raspberry Pi Computer

The Raspberry Pi is a tiny computer. In this article, I’ll explain more about what it is, and some of the amazing things we can do with it.

About the Raspberry Pi

As you can see in the picture below, the Raspberry Pi is about the size of your hand:

Raspberry Pi

First released in February, 2012, the Pi was created to let anyone learn how to use a computer. It’s a great product with an attractive price – typically varying from $20 to $40, depending on the version, though the Raspberry Pi Zero can be bought for just $5.

Several versions of the Raspberry Pi have been released, each with its own specifications. On some we find four USB ports, while on others there’s no Ethernet port, etc. You normally choose a version based on the requirements of your project. You can see obvious differences between one of the first Raspberry Pi versions (pictured above) and a Raspberry Pi 2 (pictured below):

Raspberry Pi 2

You can learn more about the components of the different Raspberry Pi computers on Wikipedia.

Power Supply and Operating System

The Raspberry Pi itself is just the motherboard you see pictured above. It’s powered through a microUSB port, and it doesn’t have any hard drive. Instead, it has an SD slot (or a microSD slot), and the OS is run from an SD card.

In terms of the operating system (OS), several are available for the Pi. Most of them are based on well-known Linux distributions such as Raspbian. But you can also install Windows on your Raspberry Pi 2 if you prefer. (The dev.windows site shows lots of fun projects you can try on a Raspberry Pi with Windows.) There’s a dedicated page on Raspberry Pi’s official website that helps in deciding what OS is best for you.

Continue reading %Creating Amazing Projects with a $5 Raspberry Pi Computer%


by Jérémy Heleine via SitePoint

Elastic Circle Slideshow

Elastic Circle Slideshow is a very simple content slideshow with circular slides and an elastic, bouncy navigation effect.


by via jQuery-Plugins.net RSS Feed

Using Inline Partials and Decorators with Handlebars 4.0

Handlebars is one of the most widely used JavaScript templating libraries for both client-side and server-side rendering. It implements the mustache specification but adds some extra sauce to make working with templates easier. If you're new to Handlebars and want to know more, I suggest you to check out my Pluralsight course on JavaScript Templating with Handlebars to learn how to get started.

Handlebars version 4.0 landed in September 2015 and brought two major new features with it: Inline Partials and Decorators. In this article, we're going to take a look at both features, explain their syntax and when you should use them. By its end, you should feel comfortable using both features to take your templating game to the next level!

Inline Partials

Partials are a common templating concept not unique to Handlebars. The idea behind it is to create templates that are likely to be re-used, separate them into their own file (a Partial), and then use them in different templates. You may think at Partials as a simple a tool to modularize your templates.

In Handlebars, Partials might not be the most convenient structure to work with. First of all, all partials are global. That means this tool may work for your application, but having little control over it could become a problem in large applications. Secondly, partials are required to be registered using JavaScript. Many template pre-compilers or loaders will handle this for you, calling Handlebars.registerPartial(). Finally, partials have to be separated from the templates where they're being used. This can be a boon if your templates are large, but can also make it difficult for developers to fully understand the output of a template. They'll need to switch between many different files before understanding the full output.

All these issues shape the way developers use partials. They end up being reserved just for the largest chunks of reusable code.

With Inline Partials, Handlebars finally releases the true potential of Partials, enabling you to drop JavaScript and the necessity to split partials into separate files. Inline Partials are defined inside your templates, in Handlebars syntax. There is no JavaScript required to register them. You just declare a partial and use it. In addition, they aren't global but block-scoped. This means that once you've declared an Inline Partial in your template, it can only be used in the current scope and any below it.

Continue reading %Using Inline Partials and Decorators with Handlebars 4.0%


by Ryan Lewis via SitePoint

3 Plugins Every Gruntfile & Gulpfile Needs

Gruntfiles and gulpfiles are ubiquitously found in web projects these days. Grunt and gulp, both JavaScript task runners (or workflow builders), are used for just about anything, e.g. minification of JavaScript/CSS files, CoffeeScript or TypeScript compilation, browser sync, etc.
[author_more]
They make use of node.js so if you’re unfamiliar with npm and how node.js works, it would be a good idea to read this tutorial series. As your gruntfiles and gulpfiles continue to grow with the multitude of plugins in the ecosystem, there are three pluginsthat you need to not only make your website great, but also make the web a better place.

JavaScript Lint Plugin

A JavaScript linting grunt or gulp plugin will help you write better JavaScript that is prone to fewer errors. In my opinion, no build workflow for the web is complete without a linting plugin. A linting plugin alerts you to problematic code and helps you write cleaner code. There are four popular linting plugins out there: JSLint, JSCS, JSHint, and ESLint. There can be endless debates around which linting plugin is the best. I recommend ESLint for two reasons.

  • ESLint is pluggable with your custom plugins.
  • ESLint supports JSX, which makes your life so much better if you are a React developer.

To get started, install the plugin in your node_modules:

npm install grunt-eslint

Or:

npm install gulp-eslint

Add the plugin to your gruntfile, don’t forget to change the target property:


grunt.loadNpmTasks('grunt-eslint');
grunt.initConfig({
        eslint: {
                target: ['YOUR_JAVASCRIPT_FILES/*.js']
        }
});
grunt.registerTask('lint', ['eslint']);

Or add the plugin to your gulpfile, don’t forget to change the src parameter:


Vareslint = require('gulp-eslint');
gulp.task('lint', function () {
        gulp.src(['YOUR_JAVASCRIPT_FILES/*.js'])
        .pipe(eslint())
        .pipe(eslint.format())
        .pipe(eslint.failAfterError());
});

Run grunt lint or gulp lint tasks to see the outputs.

Web Standards Plugin

A web standards grunt or gulp plugin will help you develop better HTML, CSS, and JavaScript code that follows the best practices of modern web standards. Following web standards will help you achieve a less buggy website that works withpast and future devices, browsers, screen sizes, etc. I have developed a grunt and gulp plugin that helps you follow modern web standards. It’s super straightforward to get started. It is a read-only plugin so it will not modify your files, it will only report potential improvements to your code.

To get started, install the plugin in your node_modules:

npm install grunt-webstandards

Or:

npm install gulp-webstandards

Add the plugin to your gruntfile, don’t forget to change the target property:


grunt.loadNpmTasks('grunt-webstandards');
grunt.initConfig({
        webstandards: {
                'src': ['dist/YOUR_COMPILED_FILES']
        }
});
grunt.registerTask('webstandards', ['webstandards']);

Or add the plugin to your gulpfile, don’t forget to change the src parameter:


varwebstandards = require('gulp-webstandards');
gulp.task('webstandards', function(){
        returngulp.src('YOUR_COMPILED_FILES/**/*')
        .pipe(webstandards());
});

Run grunt webstandards or gulp webstandards tasks to get recommendations.

Running grunt webstandards or gulp webstandards

Continue reading %3 Plugins Every Gruntfile & Gulpfile Needs%


by Rami Sayar via SitePoint

20+ Docs and Guides for Front-end Developers (No. 7)

As is often the case in front-end development, it seems we have so much to learn and so little time to do it. I’ve rounded up another 20+ learning resources, interactive playgrounds, and other goodies for front-end learning.

So please enjoy the seventh installment of our Docs and Guides series and don’t forget to let me know of any others that I haven’t yet included.

1. Meteor: The Official Guide

This is a site from the official Meteor development team, outlining opinions on best-practice application development targeted at intermediate JavaScript developers who are already familiar with Meteor.

Meteor: The Official Guide

2. Gethtml

Lists in grid format the names and descriptions of all HTML elements in the W3C and WHATWG specs. If you click an element, you’ll also see example code on how it can be used along with a link to the spec.

Gethtml

3. Learn ES2015

Maybe you’re like me and you’re tired of seeing so many ES6/ES2015 resources. Or maybe this is the one that you finally sit down with and it gets you over the hump of absorbing everything that’s new in the ECMAScript spec.

Learn ES2015

4. Flexbox Froggy

This one made the rounds a short time ago. If you haven’t seen it and want a fun way to study up on flexbox syntax, this is a very nicely done little interactive game/tutorial.

Flexbox Froggy

5. JavaScript Developer Survey Results

Nicolás Bevacqua’s study into JavaScript habits. This seems to be the first such survey that he’s conducted and he received an over 5,000 survey entries.

JavaScript Developer Survey Results

6. Flexbox.help

A simple interactive page to help you visualize how each flexbox feature works (flex-wrap, flex-direction, etc).

Flexbox.help

7. CDN Comparison

“This collection of information supports you to better find the best CDN for your content delivery needs.”

CDN Comparison

Continue reading %20+ Docs and Guides for Front-end Developers (No. 7)%


by Louis Lazaris via SitePoint

Using Classy to Create Stylesheets for Native iOS Apps

Classy is an intriguing project hoping to bridge some gaps between designers more used to web or front end projects and app developers. Classy allows for the use of ‘CSS-esque’ stylesheets to style native iOS app interface components.

Continue reading %Using Classy to Create Stylesheets for Native iOS Apps%


by Chris Ward via SitePoint

Getting Started with WordPress MVC

In WordPress we often have to stick with plain PHP when creating plugins. This leads to PHP and HTML code getting mixed up in a single page, which isn’t a good practice. Separation of concerns is a design principle that states that we should split up a program into different parts, namely the logic and the presentation. In this tutorial, we will be taking a look at one solution to this problem: WordPress MVC. It’s a plugin that adds MVC support to WordPress so we can write our plugins the MVC way.

What Is MVC?

Before we move on, it’s important that we are all on the same page. If you already know what MVC is, feel free to skip to the next section.

Ok so what is MVC? MVC stands for Model View Controller. The Model represents the data that our application utilizes. It’s the part that does the talking to the database. The View deals with the presentation. It’s where we put in HTML code and basic presentation logic. Lastly there’s the Controller whose main job is to tie those two together. Examples include validating and sanitizing user input. It’s basically responsible for controlling the overall flow of the application.

Continue reading %Getting Started with WordPress MVC%


by Wern Ancheta via SitePoint