Wednesday, June 7, 2017

A Beginner’s Guide to npm — the Node Package Manager

Functional Programming with Phunkie: Building a PHP JSON Parser

Phunkie is a library with functional structures for PHP. In this two-part tutorial, Phunkie’s creator Marcello Duarte, head of training at Inviqa, explains how to create Parser combinators using the functional library. This post first appeared on the Inviqa blog, and was republished here with their permission. For an exploration of PHP's "non-exotic" features, we have great paid course.

In the first part of this series we explored parsers and combinators to help you start getting values from functional programming with PHP. We covered the basics using examples, and now we’ll move onto more sequencing and other strategies.

Let’s pick up where we left off!

Phunkie logo

Sequencing Combinators

Ok, let’s now try a more useful parser. A parser that, given a predicate, keeps the character if it satisfies the predicate and fails otherwise. We will call this parser sat, from satisfies.

        describe("sat", function() {


            it("parses one character when it satisfies the predicate", function(){
                expect(sat("is_numeric")->run("4L"))->toEqual(ImmList(Pair('4', 'L')));
            });


            it("returns Nil when the character does not satisfy the predicate", function(){
                expect(sat("is_numeric")->run("L4"))->toEqual(Nil());
            });

        });

The implementation, using the primitive parsers item, result and zero, looks like this:

function sat(callable $predicate): Parser
{
    return item()->flatMap(function($x) use ($predicate) {
        return $predicate($x) ? result($x) : zero();
    });
}

You can see how the building blocks are now put to work. We call the item parser, flatMap on its result, and apply the predicate. If the predicate succeeds, we return the result parser, which basically lifts the $x into the parser context. Otherwise, zero will just do the same, but with Nil instead of any result.

We can quickly capitalize on sat, by creating a few other sequencing combinators.

    context("Sequencing combinators", function() {
        describe("char", function() {
            it("parses a character", function() {
                expect(char('h')->run("hello"))->toEqual(ImmList(Pair('h', "ello")));
            });
        });

        describe("digit", function() {
            it("parses a digit", function() {
                expect(digit()->run("42"))->toEqual(ImmList(Pair('4', '2')));
            });
        });

        describe("lower", function() {
            it("parses a lowercase character", function() {
                expect(lower()->run("hello"))->toEqual(ImmList(Pair('h', "ello")));
            });
        });

        describe("upper", function() {
            it("parses an upper case character", function() {
                expect(upper()->run("Hello"))->toEqual(ImmList(Pair('H', "ello")));
            });
        });
    });

You will laugh at how simple the implementation is!

function char($c): Parser
{
    return sat(function($input) use ($c) { return $input === $c; });
}

function digit(): Parser
{
    return sat('is_numeric');
}

function lower(): Parser
{
    return sat(function($c) { return ctype_lower($c); });
}

function upper(): Parser
{
    return sat(function($c) { return ctype_upper($c); });
}

Choice Combinators

In the real world of grammars, if we had to return an empty list as soon as the first parser failed, we would not survive. Parsers have to deal with grammatical choice constructs. A very common scenario is either matching one pattern or another pattern. We do that by adding the plus combinator to our arsenal of parsers.

Continue reading %Functional Programming with Phunkie: Building a PHP JSON Parser%


by Marcello Duarte via SitePoint

Nova

Nova

'Nova' is a clean Landing Page HTML template provided free by Webscope. Features include colorful intro section, feature overview, client/publicity logos, pricing table, team and ends with a newsletter sign up box.

by Rob Hope via One Page Love

Awesomed

Awesomed

Gorgeous One Page portfolio featuring slick load transitions and hover effects for design agency, Awesomed. The One Pager was built using JS framework Vue.js that actually enable One Page applications. However the issue demonstrated here is the Case Studies change your browser URL and promote a back button to a home page. In the updated submission rules this won't be allowed but letting this in purely on the high design standard. Excellent work!

by Rob Hope via One Page Love

Tom Street

Tom Street

Smart One Page portfolio for Art Director, Tom Street. Lovely touch with the video of him working in his workspace while you scroll through the screenshots. This Single Page site is actually built from scratch with Wix using a blank template - a great reference to what's possible there.

by Rob Hope via One Page Love

8 Fresh Design Tools and Resources for Your 2017 Toolbox

Estwing Hammer

This is a hammer. To be more precise, it’s a vintage Estwing Claw Hammer from the late 1960’s. It’s a beautifully-crafted, sturdy piece of workmanship, but also not very different to the hammers Estwing produce to this day. Hammers – and the way they’re used – haven’t changed a lot in 50 years. However, the web design tools and resources that we use, are different.

Look at the tools that you use today and compare them to what you were using 5 years ago. In 2012 you probably used PNGs for icons. Photoshop was ubiquitous. Sketch was a fringe design app and SVG was a weird Inkscape format. Things have changed and that will likely continue. Chances are, your next tool is already out there.

So, what design tools and resources will be in your 2017 toolbox?

That’s what we’re here to help you with today. I’ve questioned, interrogated, poked and prodded every designer and developer I know for the tools they’ve been using lately. Here is the short-list I came up with. There are apps, extensions, online tools and more, check them out and let us know if they fit your workflow!

Illusion.ai

Illusion.ai

With the emerging trend of conversational UI in 2017, the San Francisco team behind Illusion.ai sets out to create a service that allows you design and apply conversational interfaces into both your web and mobile sites. The idea is to help engage your visitors and customers in conversation about your product or service. With a variety of templates in the collection, you’re able to create a highly customizable experience and interface.

Website: https://illusion.ai/

Category: UI Design

Price: Free (Currently in Alpha)

Bottom Line: Illusion.ai makes customizable and engaging conversational interfaces not only easy to create but also to embed into your sites.

Web Developer Checklist

Web Developers Checklist

The Web Developer Checklist is an extension for Chrome instead of a web app. The extension is specifically designed for web developers as it allows them to check their web pages for any errors or violations of common practices.

While the checklist is already impressively extensive, there are plans to include Rails and Python checkers in future. For now, the extension lets developers scout out any potential problems with their site and rectify the issues.

Website: http://ift.tt/Vywq0R

Category: Utilities

Price: Free

Bottom Line: A comprehensive checklist for web developers to catch potential issues in real-time.

Freebiesbug

Freebiesbug - free design tools and resources

Created by Pasquale Vitiello, Freebiesbug is a web design blog that styles itself as a one-stop-shop for web and graphic designers who are on the hunt for the latest free resources. Featuring only the best quality, Freebiesbug’s goal is to let designers create with ease and speed by offering a host of resources that are all free including PSD, Illustrator and Sketch files along with fonts, code, and stock photography.

Website: https://freebiesbug.com

Category: Resources

Price: Free

Bottom Line: Freebiesbug is a free curated collection of high quality resources for designers and developers.

Hype 3

Tumult’s Hype 3

Tumult’s Hype 3 is a Mac exclusive tool that was created by two former Apple engineers with the sole purpose of helping you create and animate interactive HTML5 content for your sites. Along with Hype Reflect and HyperEdit, Mac users are able to work with responsive layouts to design everything from e-cards to infographics and animated site elements all without learning code.

Website: http://tumult.com/hype/

Category: Design

Price: Free 14 Day Trial or $49.99 USD

Bottom Line: Tumult’s Hype allows Mac web and graphic designers to create HTML5 content without knowing code.

Continue reading %8 Fresh Design Tools and Resources for Your 2017 Toolbox%


by Gabrielle Gosha via SitePoint

#293: The State of CSS: 5 Things You Don't Need Anymore?

This week's HTML, CSS and browser tech newsRead this e-mail on the Web
FrontEnd Focus
Issue 293 — June 7, 2017
Users can be reluctant to fill out forms, so make the process as easy as possible. Usability testing can help you find out how usable a particular form really is.
Nick Babich

Here’s what’s new in Chrome 59, including cross-platform Headless Chrome support (tutorial here) and Image Capture API support. There have also been DevTools updates, including code coverage reports and full-page screenshots.
Google

A 40-min talk looking at the metrics and platform APIs that enable user-centric performance measurement and how devs can use this data to improve end-user experiences.
Shubhie Panicker and Philip Walton

ForwardJS
Attend full-day hands-on React workshops and dozens of talks at ForwardJS San Francisco this July.
ForwardJS   Sponsor

Five supposedly ‘old-fashioned’ CSS practices that you may not need anymore (like using floats or grid libraries) and what you can use instead.
Ryan Oglesby

At this week’s WWDC, Apple announced support for WebRTC in Safari 11 on both desktop and iOS, as well as improved perf metrics tools and WebAssembly support.
Apple

Viewport units (e.g. vw, vh, vmin, vmax) have been around for a while, and are well supported. Here’s a look at various uses for them.
CSS Tricks

Introduced with the CSS Grid Layout Spec, the minmax() function “opens the door to us being able to write much more powerful and succinct CSS”.
Ire Aderinokun

The Chromium team have expressed an intent to implement an asynchronous cookie API, which is particularly useful for Service Workers.
Benjamin C. Wiley Sittler

Jobs Supported by Hired.com

Can't find the right job? Want companies to apply to you? Try Hired.com.

In Brief

Tracking Prevention Coming to Safari news
Safari to reduce cross-site tracking by limiting cookies and more.
John Wilander

Wake Lock API: An API to Let Webapps Keep a Device Awake news
W3C

What's The Stuff at the Top of an SVG? tutorial
Peter Nowell

Beautifully Animate Points with WebGL and regl tutorial
How to draw and smoothly animate 100,000 points in the browser.
Peter Beshai

How to Build Web Form Layouts With CSS Grid tutorial
Ahmad Shadeed

Locally Scoped CSS Variables: What, How, and Why tutorial
CSS Variables are super powerful, and scoping them locally makes them an even more powerful tool for clean, modular design systems.
Una Kravets

Non-Linear Interpolation in CSS tutorial
Mike Riethmuller

An Intro to Web Components (with Otters) tutorial
An introduction for absolute beginners.
Monica Dinculescu

Learn Flexbox in 10 Minutes tutorial
Justin Yek

Masking vs. Clipping: When to Use Each tutorial
Sarah Drasner

Why IT Consulting and Developer Services Companies Love Compose opinion
Software firms and app developers love using Compose to manage data for their clients – find out why.
Compose  Sponsor

Designer vs. Developer #1: Creating a Collaborative Environment video
Mustafa Kurtuldu (a designer) speaks to developer Jake Archibald about communication and the assumption that designers and developers sole role is to either make things look pretty or to be a cog in a machine with no soul.
Google Chrome Developers

Sandcat: A Lightweight Multi-tabbed Web Browser tools
Features include live HTTP headers, an extensible command line console and more.
Felipe Daragon

svgi: An SVG Inspection Tool tools
Ángel M Miguel

taxi-rank: A JSDom-Based Selenium Webdriver API code
Uses Zombie under the hood.
Forbes Lindesay

LQIP-Loader: Low Quality Image Placeholders (LQIP) for Webpack code
Zouhir Chahoud

$20 Free Credit on a new account. 
Linux cloud hosting starting at 1GB of RAM for $5/mo. Use promo code HTML520 and get $20 credit.
linode  Sponsor

Curated by Peter Cooper and Chris Brandrick and published by Cooperpress.

Stop getting FrontEnd Focus : Change email address : Read this issue on the Web

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


by via FrontEnd Focus