Friday, June 17, 2016

SVG Triangle Generator using JS

Simple demo of generating an equilateral triangle in SVG using JS.

The post SVG Triangle Generator using JS appeared first on jQuery Rain.


by Admin via jQuery Rain

Thursday, June 16, 2016

Julie Poignot

Portfolio of Julie Poignot, UX Designer & Front-end Developer.


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

Breaking Down the Anatomy of a Successful LinkedIn Profile [INFOGRAPHIC]

This infographic will guide you how to shine on LinkedIn

“Today, the vast majority of business professionals and job seekers are using LinkedIn as their resume to proactively learn about new opportunities that can advance their careers. As a result, LinkedIn has quickly risen to the top of the recruiting chain. With its millions of users and targeted groups, this social platform is a key tool for recruiters to find and hire top talent. Are you maximizing your odds of being noticed on LinkedIn?”

This infographic, created by Akkencloud, illustrates the anatomy of a successful LinkedIn profile, helping you get found and stand out among the competition.

by Irfan Ahmad via Digital Information World

How to Find Cool, Quirky, Copyright Free Photos on Flickr

I think we're all always looking for that touch that makes a design feel fresh and different - a pattern, a photo, or a texture that doesn't feel like stock. One of my favorites sources is Flickr - but probably not the way you use it.

Sure, most of us know about Flickr's vast library of creative commons licensed images but there's another rich vein of fascinating imagery worth exploring.

[caption id="attachment_133402" align="alignright" width="410"]J.L.M. Lauweriks. Alphabet, [1900]. NAI Collection J.L.M. Lauweriks. Alphabet, [1900]. NAI Collection[/caption]

Many of the world's great libraries, government agencies, private companies, national & state archives, museums, and historical societies use Flickr as a catalog for their book, documents, illustrations, and photographs. All in the Public Domain and copyright free.

This includes organizations such as:

The Internet Archive of Book Images alone has been digitizing lapsed copyright books for well over a decade now, and now has more than 5 million images on the site.

The works fall into two broad categories.

  1. Works with lapsed copyright: These are old works - books, magazines, posters and advertising materials - where copyright and often the creator/s themselves expired long ago.
  2. Works of unknown creator/s: Often archive photos, these are works where the creator's identity (and by extension, copyright) can no longer be established.

Accessing these images isn't hard. Perform a standard search, click the 'Any license' dropdown on the top left and hit 'No known copyright restrictions'.

[caption id="attachment_133404" align="aligncenter" width="703"]Flickr search - no known copyright restrictions Flickr search - 'No known copyright restrictions'[/caption]

How might you use these images?

Clearly we're not talking about the kind of smooth graphics you'd expect to find on a big stock site, so you need to be strategic. This is a gargantuan library so you could be clicking that 'next page' link for days.

Continue reading %How to Find Cool, Quirky, Copyright Free Photos on Flickr%


by Alex Walker via SitePoint

Accessing the User’s Camera with JpegCamera and Canvas

Over the past decade, browser vendors have introduced various new APIs that enable us as programmers to create richer and more fluent experiences. One of these is the getUserMedia API, which enables access to the user's audio and video devices. However, it's still not quite there yet in terms of browser compatibility.

With this in mind, Adam Wróbel wrote JpegCamera, a library that takes into account the different caveats among browsers for interacting with user's camera and provides fallbacks for those cases where access to client's media is not supported.

In this article we'll see how by using JpegCamera, together with HTML canvas element capabilities, we can build a clone of Instagram's Layout app:

Screenshot of the Layout-like app using JpegCamera and Canvas.
The demo Layout-like application

The source code for the demo can be downloaded from Github.

The JpegCamera Library

JpegCamera allows you to access the user's camera as part of your application, gracefully degrading to a Flash fallback if the browser does not support getUserMedia().

The first step to is to include the necessary scripts in your project.

The library depends on the SWF Object and Canvas to Blob libraries, both of which come as part of the zip download from the project's Github page. However, in the same zip there's a with dependencies version of the script, which provides the same functionality as having the three scripts loaded in the page.

With this in mind, you can either include the three needed scripts.

<script src="/jpeg_camera/swfobject.min.js" type="text/javascript"></script>
<script src="/jpeg_camera/canvas-to-blob.min.js" type="text/javascript"></script>
<script src="/jpeg_camera/jpeg_camera.min.js" type="text/javascript"></script>

Or just go with the one script alternative.

<script type="text/javascript" src="js/libs/jpeg_camera/jpeg_camera_with_dependencies.min.js"></script>

For production environments, the later seem to be the way to go, unlike during development.

Once the library is included you can use the global JpegCamera object to check the camera availability, and choose how to manage the fallback if not.

If the access is granted, you can setup a listener for when the camera is ready with the JpegCamera() constructor.

The JpegCamera() constructor takes a CSS selector as an argument which should identify the container to be used for the camera stream.

The snippet below shows the code that does this:

(function() {
    if(!window.JpegCamera) {
      alert('Camera access is not available in your browser');
    } else {
      JpegCamera('.camera')
        .ready(function(resolution) {
          // ...
        }).error(function() {
          alert('Camera access was denied');
        });
    }
})();

This way, you can setup your application to only start once the camera is ready, or let the user know that they either require a different browser or need to enable camera access for the application.

Inside the ready callback function, the device's camera resolution is passed as the first argument. This can be useful if the application we are building relies on the device's camera quality (i.e.: to make HD capture available or not).

Meanwhile the error callback receives as an argument a string message explaining what happened. If you need to show the user an explanation in case of an error, you can use the message the library supplies.

In addition to this, the JpegCamera API provides the following methods:

  • capture(): This is the method that takes a picture. It returns the image itself as a Snapshot object (the class that JpegCamera uses for images).
  • show(): Once you take the picture, the Snapshot object that you obtain allows you to display the image in the page, by invoking its show() method. The image will be displayed inside the same container you specified when initializing the camera.
  • showStream(): If a snapshot is currently displayed in the container, showStream() hides the image and displays the stream.
  • getCanvas(): Takes a callback function as a parameter, which will receive as an argument the canvas element with the captured image.

Let's dive into an example application that illustrates what JpegCamera allows us to do.

Building the Application

The demo application emulates (sort of) what Layout does: it allows the user to take photos and generates new images by combining them. In our version, the combined images can be downloaded by clicking on them.

The application structure is based on the Module Pattern. This pattern gives us a couple of benefits:

  1. It allows to have a clear separation between each of the application components.
  2. It keeps our global scope clean by only exposing methods and properties that are strictly required by the others. In other words, we get to use private attributes.

You'll notice that I pass three parameters into the self invoked functions:

(window, document, jQuery)

And these arguments are received:

function(window, document, $)

The reason for passing window and document is for minification purposes. If we pass these as arguments, then each of them can be replaced for a single character. If we had just referenced these global objects directly, the minifier would not be able to substitute them with shorter names.

With jQuery, we do it to avoid conflicts with other libraries that might also using $ as their main function (i.e.: Prototype).

At the top of the Layouts and Custom modules you'll see something along these lines:

if(!window.LayoutApp) {
  window.LayoutApp = {};
}

This is for two reasons:

  1. We prevent the modules from generating errors in case we did not include the scripts properly in index.html.
  2. We keep our global scope clean by making the modules part of a main one and only available for it once the application starts.

The application logic is divided into three modules:

  • The App module
  • The Layouts module
  • The Custom module

These three modules together with our libraries must be included in our index.html as follows:

Continue reading %Accessing the User’s Camera with JpegCamera and Canvas%


by Martín Martínez via SitePoint

Getting Started with HHVM and WordPress

Only a few months ago, HHVM (HipHop Virtual Machine) was a popular buzzword in the PHP community. Many of us were curious about this technology, especially the reports of improved performance. Previously, Zend’s PHP was the only alternative — until Facebook introduced HHVM to the world.

HHVM and WordPress

Good news, HHVM is no longer a buzzword. Many people (including myself) dislike hyped up technologies, but I’m happy to write this as a post-buzzword article.

So let's dive in!

In this article, I'll cover:

  1. What is HHVM?
  2. What is Hack?
  3. What is the difference compared with traditional PHP?
  4. Why is it so important that it exists today (or maybe not)?
  5. What are some benchmarks to see how HHVM differs from PHP 5 and PHP 7?

What is HHVM?

To understand what HHVM is, we first need to cover what Zend Engine is (currently we're at version 3 with PHP 7). The best explanation on this can be found on this Wikipedia article:

The Zend Engine is the open source scripting engine that interprets the PHP programming language. It was originally developed by Andi Gutmans and Zeev Suraski while they were students at the Technion - Israel Institute of Technology. They later founded a company called Zend Technologies in Ramat Gan, Israel. The name Zend is a combination of their forenames, Zeev and Andi.

Is it the language or an interpreter? It's a ongoing debate with every scripting language. However, let's say that PHP the language, is abstract, it's a blueprint for the interpreter (parser). It's more of a philosophical debate than a real debate. HHVM is like Zend Engine, but it takes a different approach to parse and run the source code.

Continue reading %Getting Started with HHVM and WordPress%


by Aleksander Koko via SitePoint

This week's JavaScript news, issue 288

This week's JavaScript news
Read this e-mail on the Web
JavaScript Weekly
Issue 288 — June 16, 2016
Todd has built upon his earlier, highly popular Angular styleguide, and rewritten it to match modern practices and the use of ES6.
Todd Motto

It might be gentle, but this is a thorough (you’ll need a full cup of coffee) article that goes into a lot of detail.
Dmitri Pavlutin

A slimmer, faster version of jQuery. There’s an upgrade guide and a script to help with migrations.
jQuery Foundation

Learn to build your own AngularJS chat app with realtime messages and more in no time. Register for this developer training webinar now. (Limited seating. Seats fill fast.)
Pubnub   Sponsored
Pubnub

An attempt to recreate React's core value proposition in as little code as possible, with first-class ES6 support.
Jason Miller

RC2 brings new techniques for building forms, Web Worker enhancements, and the Animation Framework. See full release notes here.
Angular JS

Like many, Tatu was disinterested when he first heard about TypeScript, but now he’s convinced most of us should be using it, or at least giving it a try. A lengthy discussion on Hacker News followed.
Tatu Tamminen

“Test Driven Development is one weird trick that will change the way you code forever (in a good way).”
James Sinclair

Jobs

  • craigslist seeks JavaScript Developers (San Francisco, CA)CL seeks web devs with JavaScript, CSS, and HTML experience to join a small (~50), tech-driven, laid-back workplace to design and ship new features daily, and see them loved (or hated) by millions. Come help us save the world, or at least our corner of the Internet. craigslist
  • Senior Node Engineer at TES USA (San Francisco, CA or remote)Make a difference in teachers’ lives with a platform that allows them to find, share and sell resources worldwide. Join TES USA’s small, global team to embrace challenges, be part of a lean process, and impact education. TES USA
  • The Easiest Way to Find a JobHired lets you sit back while job offers come to you. When you complete your profile, instantly apply to 3,500+ companies on the platform who will contact you with job offers, including salary and equity up-front. Try it today. Hired.com

In brief

Looking for more on Node? Read this week's Node Weekly too :-)

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