Power a blog using the WordPress API

Original Source: http://feedproxy.google.com/~r/CreativeBloq/~3/FAHDBL31eIM/power-a-blog-using-the-wordpress-api

Over the past few years, the development of a REST API for WordPress has opened new doors for developers. Developers who had previously been limited to writing a WordPress-powered project in PHP now have more flexibility and control in how they can approach the technology stack of their website-to-be.

This means it’s possible to retain all the advantages of the brilliant WordPress control panel, which is made extremely flexible by popular WordPress plugins such as Advanced Custom Fields, and have a completely custom built frontend that only interacts with WordPress when it needs to.

Download the tutorial files

In this WordPress tutorial we’ll be exploring how to implement the WordPress REST API into a simple blog app, which is currently using a local JSON file as its data source, and is built as a single-page application (SPA) using the popular JavaScript framework Vue.js. This will involve the implementation of Vuex, which we’ll use to store the data we request from a WordPress using a combination of its action and mutation methods.

Once completed, you should have created a lean, simple SPA, which has all the reactivity of Vue.js, while displaying posts retrieved from and managed by WordPress.

01. Set up workspace and dependencies

First things first, you should download the project’s files and open them in your preferred editor. 

In the console, cd into website-template and run the command below to install the project’s node dependencies (if you don’t have Node installed, do that first). We’ll be working purely in the src directory from here on out.

02. Install Vuex 

Next, using the command below, we’ll install Vuex, which is a state management pattern and library for Vue.js applications. This will act as a central information store for all Vue components that depend on the data we receive from WordPress API. For developers familiar with React, Vuex is heavily inspired by Flux.

03. Start development server

In the console, run the command below to start the development server. This will compile the Vue.js project as it currently stands and assign it to a URL so you can access it. This is usually localhost:8080.

One big advantage this brings is live reloading, so once you make changes to the app and save, the page in your browser will update itself without the need to manually reload.

04. Create Vuex store

In src, create a directory called store and within it a new file called index.js. This will be where our Vuex store will be defined. Though before we get to that, we need to first make sure our Vue.js app is aware of its existence. To do this, open main.js and import the store and include it as a dependency, as in the snippet below.

05. Create store scaffolding and install Axios

To help us simplify the AJAX requests our store will be making to WordPress API, we’ll install Axios, which is a Promise-based HTTP client. To do this, open a separate console window, navigate to the website-template directory and run npm install axios — save.

Next, let’s start to scaffold the store by instantiating a new empty Vuex store object. At the moment, it isn’t doing anything, but at least Vue should be aware of it.

06. Create posts state

In Vuex, the state object holds application info, which in this case will be the WordPress post data we’ll grab using the API. Within this object, create a new property called posts and assign it a value of null.

07. Create getPosts action

In Vuex, actions are the main way in which asynchronous requests are handled. These are typically methods defined in the store, which can then be dispatched as required by the app.

In the empty actions object, let’s define one where if our posts state is still null, axios is used to perform an AJAX request to the WordPress API and return a list of posts. Once we’ve received a positive response, we’ll then resolve the promise and commit the posts using the storePosts mutation.

08. Create storePosts mutation

Another concept introduced by Vuex is mutations, which are also typically methods defined in the store. Mutations are the only way to change state in a Vuex store, which allows state to be easily tracked when debugging.

In the empty mutations object, let’s define the storePosts method we referenced in the previous step and make it override the post property in the state object with any data the mutation receives as payload.

09. Trigger getPosts action on load

We’ve created the action and mutation methods that grab posts from WordPress API and commit them to Vuex state, but now we need to actually trigger this process somewhere. In the top level Vue.js component App.vue, add the snippet below.

created() is a lifecycle hook that triggers code as soon as the Vue component is created on load, while the use of the global $store variable allows us to access the contents of our Vuex store and dispatch the getPosts action from step 7.

10. Update attribute paths

The Vue DevTools extension gives you the power to debug your Vue.js app

If you’re working in Chrome or Firefox and have the Vue.js DevTools extension (if not, I recommend that you do as it’s very useful), you should now be able to see the loaded WordPress posts in Base State under the Vuex tab. 

Back to the app, in /components/posts/posts.vue, the template HTML needs to point to this data, so let’s tweak a few of the attribute paths.

11. Update v-for loop

In the posts component, there’s a Vue.js directive in use called v-for. This loops through all posts and for each one prints an instance of the post component, displaying them in a list. 

We need to update the path passed to this directive as it’s still using the local dummy test data. Update the v-for directive to the snippet below in order to point to our stored posts in the Vuex store.

12. Do some housekeeping

A list of the WordPress posts should now be displaying. As we're no longer using the local post data, let's delete src/data. Then in the posts component, remove the posts: postData.data property in the components local data store and then the postData import.

13. Fix post author

You may notice that for each post the author is showing up as a number. This is because the WordPress API returns an author ID, rather than a name. We need to use this id to query WordPress for the full author information. Let's start by creating a place to store this in our Vuex store, alongside our post info, in store/index.js.

14. Create getAuthors action

As with posts, we'll create an action in /store/index.js to trigger an AJAX request to query WordPress API. Once a successful response is received, the promise will then resolve and trigger the storeAuthors mutation, which we'll create next.

15. Create storeAuthors mutation

Within the mutations object of the Vuex store, create the storeAuthors mutation using the snippet below. Like with storePosts from step 8, this takes the payload its passed and sets it as the value of the authors property in our store's state.

16. Trigger getAuthors on load

We need to get the author info from WordPress as soon as the app begins to load. Let's amend the top level component App.vue again and dispatch the getAuthors action in the same created() lifecycle hook as the getPosts action.

17. Create getUserName method

Now we're querying WordPress for author information on load, all we need to do is define a method in our posts component which lets us pass an author ID and get a name in return. Copy the snippet below into the posts component's methods object, below the existing getSinglePost method.

18. Call getUserName method

Now we just need to call getUsername. Still in the posts component, in the template, replace the author attribute’s reference to post.author so it reflects the snippet below. The author’s name should now be correctly displaying for each post.

19. Blog loading

As we’re loading the post data asynchronously, there is a moment before the request completes where the application is empty. To counter this, we’ll implement a loading state that's active until the blog is fully populated. In the posts component, paste the snippet below just after the opening <script> tag to import the icons we’ll be using.

20. Add icon to components list

Next, still within posts, add a reference to icon in the components objects. This makes the posts component aware of our recently imported icon component.

21. Create loading elements

We now just need to add the loading elements to the posts template so it shows up on the page. Firstly, wrap the second div in the snippet around the two divs with the v-if directives to make sure no posts show up until loading is complete.

Then add the first div from the snippet above it. This contains the loading icon and a v-if directive, which means it will only be visible until the point where the app is fully loaded. Once done, loading should now be implemented.

22. Update single post attribute paths

The only thing left to do is to make sure single posts are correctly set up so they are using the WordPress post data in the Vuex store. The first step is to update the attribute paths in the posts component template within the v-if="this.type === 'single'" div, which handles the display of single posts.

23. Refactor getSinglePost method

We also need to refactor the posts components getSinglePost method. It needs to return a promise that dispatches the getPosts action. In the follow up then function, we'll search the Vuex store's posts for an entry with a slug matching the one passed in the URL. If found, we'll copy the data to our component's local state and resolve the promise. If it isn't found, the promise will be rejected.

24. Refactor posts created() hook

Next, we need to refactor the created() lifecycle hook in the posts component. If we're needing to display a single post, the hook should call the getSinglePost method from the previous step, and if its promise is rejected, send the user to the 404 'page not found' page. This is to account for scenarios where users enter a non-existent post slug in the URL.

25. Add v-if directive

The final step is to add the snippet below to the post component within the v-if="this.type === 'single'" div in the template. This directive means the post will only display when the local post data made available by the getSinglePost method is populated. This is to stop Vue from prematurely rendering the component and thus causing errors.

26. Build the app

Now with everything working, in the console, cancel the npm run dev command or open a new console and run the below command to generate a production ready version to upload to your own server. This will appear in the dist directory.

This article appeared in issue 268 of Web Designer, the creative web design magazine – offering expert tutorials, cutting-edge trends and free resources. Subscribe to Web Designer now.

Read more:

32 best free WordPress themes10 top WordPress resourcesThe 14 best free blogging platforms

Now You See Me: How To Defer, Lazy-Load And Act With IntersectionObserver

Original Source: https://www.smashingmagazine.com/2018/01/deferring-lazy-loading-intersection-observer-api/

Once upon a time, there lived a web developer who successfully convinced his customers that sites should not look the same in all browsers, cared about accessibility, and was an early adopter of CSS grids. But deep down in his heart it was performance that was his true passion: He constantly optimized, minified, monitored, and even employed psychological tricks in his projects.
Then, one day, he learned about lazy-loading images and other assets that are not immediately visible to users and are not essential for rendering meaningful content on the screen.

Preparing for the WordPress Gutenberg Editor

Original Source: http://feedproxy.google.com/~r/1stwebdesigner/~3/xlnNo1XEq5g/

If you use WordPress, a big change is coming. The impending release of version 5.0 will bring along with it the new Gutenberg editor. It’s poised to become a major step up in terms of the ability to customize the look of your content in a default WordPress installation.

It’s a very different experience in that this new editor will break content sections down into “blocks”. Blocks will enable you to, say, add a full-width image right in the middle of a blog post. Or you might build your own custom blocks that allow users to implement different layouts.

In short, Gutenberg brings a little bit of what page builder plugins have been doing for years – without some the fancier bells and whistles. It’s a more unified way to mix text and multimedia into your content. And it promises to be a much more user-friendly and visual way to do things.

This evolution has brought about a ton of debate and, naturally, a good bit of concern. WordPress boasts an enormous market share and designers/developers/users are rightfully wary of such a big change. The team responsible for Gutenberg is taking steps to assuage concerns, but the bottom line is that we won’t know the full effect of things until the official release.

While WordPress 5.0 will be released sometime in 2018, you can try Gutenberg now in the form of a plugin. If you want to get a behind-the-scenes look, check out the 2017 State of the Word Address, which features a live demo.

Gutenberg is something that all of us should be aware of. In order to take full advantage of the new editor, there are some steps we’ll have to take. Plus, some may decide not to use it at all as the “classic” editor will still be available as a plugin for the foreseeable future.

With that in mind, let’s take a look at how to prepare for the big change. We’ll look at the considerations and share some helpful resources that can guide you along the way.

The Gutenberg Editor

The Decision to Switch (Or Not)

Major changes to any software usually lead a healthy portion of users to avoid upgrading. Operating systems are a great example as many larger companies are still a version or two behind. Of course, for security and compatibility reasons, it’s never recommended that we run outdated versions of WordPress. So, in that way, upgrading to 5.0 isn’t really optional.

But since we can decide to continue using the classic editor via a plugin, the decision of whether to utilize Gutenberg is one we’ll all have to make. Depending on the setup of your site, switching could be kind of a big deal. Developers will have to consider:

Any potential complications with existing themes, plugins and customizations.
If a client is responsible for managing content, some training may be required.
The increased demand for customer support, should something unexpectedly break.
If you’re already using a page builder plugin, does it make sense to change?

One thing is for sure, it will be a process for many of us. For mission-critical sites, it might not be a great idea to implement changes without testing them first within a development environment. If you manage multiple sites, that can be a whole lot of work.

I would suspect that some developers would choose to hold off on switching for some time – at least for existing sites. On the other hand, if a site could really benefit from the added capabilities of Gutenberg, then it might make sense to take the plunge.

Your Theme and Gutenberg

By default, your theme should work with Gutenberg just as it does now with the classic editor. But you do have the ability to add in extra styling for the various available blocks. For example, the image block places code similar to the following into a published page:

<figure class=”wp-block-image”><img src=”your-image.jpg”></figure>

So, you could provide some CSS for .wp-block-image to jazz things up a bit – although it’s not required.

But where the editor really holds promise with themes is the ability to create your own custom blocks. Think of the potential to add site-specific layouts and content directly into the editor. Then add in the fact that you can pass styles on to the back end of your site, providing users with a more accurate WYSIWYG experience. This could be quite the game-changer when building a site. Check out the resources section below to learn more.

Your Theme and Gutenberg

Plugin and Customization Compatibility

This is where much of the concern lies with both developers and site owners. Untold numbers of websites have had their back end customized in some shape or form. And just about everyone with a website that runs on WordPress uses plugins. So yes, there is the potential for something to go wrong.

However, this is an area where the folks behind-the-scenes are really working diligently. Backwards compatibility has always been a key part of WordPress and that doesn’t figure to change now. And the larger plugins out there all have an incentive to make sure that their products work with the new editor. There’s simply too much to lose for everyone involved for this not to work.

But, as mentioned earlier, testing everything out in a development environment is the best way to know how Gutenberg will affect the setup of your site. From there, you can figure out what (if any) issues you might need to clean up.

While it certainly sounds like most configurations will work just fine, there is always that chance that something doesn’t play nice with the new editor.

Client Considerations

One other area of interest is how Gutenberg may affect your clients. The way it stands, not everyone knows that an entirely new editing experience is on the way. Casual users probably aren’t paying close attention, even though recent WordPress upgrades have mentioned the coming changes. So they may be in for a bit of a shock when 5.0 drops.

But this is where we can take it upon ourselves to make a difference. Engage clients and let them know that Gutenberg is on the horizon. Provide a general background and maybe a few user-friendly links that might help them become more familiar with the UI.

A little bit of education now can (hopefully) save you from a few panicked calls later on.

Client Considerations

Resources

As Gutenberg continues to evolve, there are more valuable resources coming out to help you learn and prepare:

Gutenberg Handbook
There is a process behind creating custom blocks. To learn more, check out the Gutenberg Handbook. It takes an in-depth look at how the editor works and provides some tutorials on block creation.

Gutenberg Boilerplate
Ahmad Awais has created a boilerplate for building custom blocks for Gutenberg. He has included a few different scenarios that can serve as a great learning tool.

Gutenberg Theme
If you want to see an example of how a theme can take advantage of Gutenberg, take a look at the free Gutenberg Theme over on GitHub. It was built by Tammie Lister, who is the head of the team working on the new editor. The theme isn’t necessarily meant for a production environment, but provides a useful playground for interested developers.

WordPress Gutenberg Guide
Codeinwp has put together an illustrated guide that will get you familiar with the basics of Gutenberg, along with some more advanced tricks.

Development Updates
The official source for Gutenberg Development Updates is a great way to keep up with new features, along with thoughts from the developers themselves.

Block Party

The full release of Gutenberg will be a watershed moment in the history of WordPress. And, overall, it looks to be a change for the better. There will certainly be an adjustment period and some bumps in the road. But that is only more the reason to dig in now and see how everything works.

You’ll get a sense of how you might benefit from Gutenberg and valuable knowledge on how to handle the transition ahead.


Monthly Web Development Update 1/2018: Browser Diversity, Ethical Design, And CSS Alignment

Original Source: https://www.smashingmagazine.com/2018/01/monthly-web-development-update-1-2018/

I hope you had a great start into the new year. And while it’s quite an arbitrary date, many of us take the start of the year as an opportunity to try to change something in their lives. I think it’s well worth doing so, and I wish you the best of luck for accomplishing your realistic goals. I for my part want to start working on my mindfulness, on being able to focus, and on pursuing my dream of building an ethically correct, human company with Colloq that provides real value to users and is profitable by its users.

What Is Node and When Should I Use It?

Original Source: https://www.sitepoint.com/an-introduction-to-node-js/

So you’ve heard of Node.js, but aren’t quite sure what it is or where it fits into your development workflow. Or maybe you’ve heard people singing Node’s praises and now you’re wondering if it’s something you need to learn. Perhaps you’re familiar with another back-end technology and want to find out what’s different about Node. […]

Continue reading %What Is Node and When Should I Use It?%

The Freelancer’s Guide to Success and Happiness

Original Source: https://www.webdesignerdepot.com/2018/01/the-freelancers-guide-to-success-and-happiness/

In 2016, 34% of the US workforce worked as freelancers, and by 2020, it’s estimated that number will rise to 43%. Freelance opportunities aren’t going anywhere, and more professionals are swapping in their office key cards for a home office.

While the idea of sitting around in sweatpants or relaxing on a beach while working sounds like perfection, freelancing isn’t always a walk in the park. From juggling business responsibilities and invoices to finding your next gig, freelancing comes with its issues. Despite these challenges, a few tips can help you find success and happiness in your career.

1. Believe in Your Worth

Particularly when you’re new to freelancing, it can be intimidating to set your fee. While some projects or jobs may entail negotiation, it’s best to set your rates and stick to them. Depending on your niche, you may work on an hourly rate or quote per project. Set a rate that’s on trend with your industry rather than settle. While you may find more gigs when charging less than the industry average, you’ll experience more stress trying to juggle enough projects to meet your income goals.

2. Network Even When You’re Not Seeking Work

Networking is the lifeblood of freelancing; it’s necessary to keep your business alive. Even when you have contracts, freelancing jobs can be unpredictable. You may have ten small projects one month and three ongoing projects another month.

Finding yourself low on projects can be stressful to your mental health and your wallet. Keep networking with other professionals, freelancers, and potential employers even with plenty of projects on your plate. This effort makes it easier to find a job when you’re looking for your next gig.

3. Hire an Accountant

If you make a single business investment, hire an accountant. Unlike W-2 employees, who have a portion of taxes paid by their employers, freelancers have to cover all of their own taxes and manage their own expenses.

During tax season, it can be confusing and overwhelming to determine the tax credits for which you qualify and what taxes you owe. Working with an accountant not only makes it easier to track expenses and save on taxes but also gives you clearer insight into how much you’re earning after taxes.

4. Set a Schedule and Stick to It

Working the standard nine-to-five Monday through Friday can feel restrictive, but businesses are onto something when they adhere to a consistent schedule. Whether you prefer to work late at night or early in the morning, set a regular schedule for your work week, including the days and hours you’ll work. Aim to schedule four days of work and one day for handling administrative tasks, such as following up on emails, taking care of bills and invoices, and networking. A regular schedule helps you get into a work mindset each time you start your day.

5. Don’t Skimp on Business Necessities

Working as a freelancer means wearing a business-owner hat too. While it’s tempting to cut back on costs wherever you can, it’s worth investing in the tools you need to do your work efficiently. One service you should never skimp on is a reliable high-speed internet connection for communicating with employers and completing projects. Take the time to find the fastest internet in your area and calculate your bandwidth needs based on the type of work you do. With a fast connection, you can complete your work faster and avoid the frustrations of lag.

6. Don’t Be Afraid to Say “No”

When you determine your income, it’s easy to make the mistake of taking on too much work. If you’re tempted to take on another project for the additional income, consider the cons: additional stress and less time to decompress. Don’t risk your mental health for a bump in pay. Before agreeing to any new project, look to see if it will realistically fit into your schedule. If it won’t, turn it down or explain what deadline would work for you.

Working as a freelancer is an exciting career move, offering independence and opportunities to challenge yourself and enhance your skills. While freelancing isn’t the easiest gig, following these helpful tips can help you find happiness and success in your career.

LAST DAY: The Immense Typography Collection of 120+ Fonts & Logos – only $17!

Source

p img {display:inline-block; margin-right:10px;}
.alignleft {float:left;}
p.showcase {clear:both;}
body#browserfriendly p, body#podcast p, div#emailbody p{margin:0;}

How to Increase Your Productivity as a Freelance Web Designer?

Original Source: http://feedproxy.google.com/~r/1stwebdesigner/~3/MdA45-G7g4w/

Freelancers often find themselves wondering how to be more productive. They look into ways to do more work in the same amount of time or do the same amount of work in less time.

This frustration is often based on an inability to stay focused. Freelancers are not tied to strict schedules, nor do they work under the supervision.

An obvious solution is to become more disciplined. However, this piece of advice is about as useful as being told to “work smarter”. This is unless, of course, you’re given some direction on how to go about it.

The following three productivity techniques can turn things around for you. They’re easy to put into practice, and you can start today!

Productivity Technique #1: With Be Theme’s pre-built websites, you can finish a client’s website in 4 hours

Be Theme’s gallery of pre-built websites is not only impressive; at 300+ and counting, it’s the largest on the market. Not only can you find the right one to work within a matter of minutes, but you can install it with a single click.

You need not worry about writing code or building wireframes either. You just need to pick your pre-built website.

Be Theme’s powerful assortment of pre-built websites will allow you to build a website in 4 hours. How’s that for productivity?

Here’s what other freelancers have to say:

10 Be Theme pre-built designs you could use to build a functioning website in a matter of hours
Be Salmon

The large food presentation images are guaranteed to capture user attention, as is the customer’s testimonials section. Users also appreciate how the interactive menu assists navigation.

BeDetailings2

A bold, professional appearance featuring before and after images is what clients and users want to see in a website representing a niche of this type. The price listing for services encourages users to respond to a call for action.

BeMeeting

Features include a standard menu for events & meetings websites, and an eye-catching countdown clock. A “clean” design like this one, always supports a user’s need for easy navigation.

BeManicure

Luxurious imagery, soft design, and an overall feeling of elegance and professionalism is what can make any website serving this niche successful. The integrated eShop will impress the client, and is a real productivity booster for the designer.

BeDenim

Bold imagery & color combinations are used to attract and engage the audience this website is speaking to. Its intuitive icons that promote easy navigation, and the integrated eShop do the rest.

BeHipHop

A creative website serving a pop culture deserves a hip design like this one. The integrated video and audio player will keep users interested, and the section outlining concert and album release announcements ensures repeat visitors.

BeCafe2

It’s amazing how large images like this one inside the online menu can draw in customers. This pre-built website also features a photo gallery of the business, and an informative “About Us” page.

BeDrawing

This pre-built website’s key features contribute to the success of a creative business’s online presence. They include an impressive gallery, a presentation video, and a simple and clean design.

BeTraining

Important features in a website for this niche include an intuitive menu for an eLearning platform, the ability to easily navigate through an events calendar, and the use of large, attention-getting video thumbnails.

BeClinic2

A sharp, simple design like this one, is always a good design approach for this niche. It is easy to navigate and easy to find and read important information.

Productivity Technique #2: Be more flexible instead of forcing yourself into a strict schedule

Being more disciplined can make you more productive. Yet, taking a “nose-to-the-grindstone” approach can sometimes do more harm than good. Working to a schedule (something not always easy for a freelancer) has its good points, but it’s all too easy to overdo it.

As a freelancer, you can manage to be flexible in your workday activities. Like that, you’ll generally be better off, in terms of productivity.

What does “being flexible” mean?

When you’re working on a task and get stuck; take a break. Go outside for some fresh air; take your dog for a walk; enjoy a cup of coffee with a friend.

Your subconscious mind will continue to work your problem. It does a better job of it without your “conscious” interference. With this approach, you’re much more apt to experience those rewarding “Got it!” moments.

Being flexible can also mean working to a general to-do list, rather than an overly specific one. Make a list of what you want to get done, but not the steps you need to take on how to get things done. People have a greater tendency to get hung up on specific tasks than on more general ones. This can lead to frustration, and an inability to get anything done.

Productivity Technique #3: Calculate how much a lack of productivity can cost you every day

There is no doubt you are familiar with the saying that “time is money”. In fact, you can, without much effort, calculate how much a lack of productivity can cost you every day.

The hard way is to keep track of the time you spend on each of the tasks you work on a day. Doing so can hint at how productive you might be, but doesn’t tell you much about how you could be more productive.

A better approach is to keep track of those periods where you’re not being productive when you should be. For instance, when you find yourself procrastinating or wasting your time. This is what you need to know.

These non-productive periods are habits you’ve acquired that slow down the process. But, you can do something about. These do not include walking your dog or enjoying a cup of coffee, or taking a 15-minute break to clear your mind!

You might be working on an hourly fee basis or a fixed fee basis on an assignment. Either way, you can generally calculate the cost per hour you’re charging. Now, it’s simply a matter of adding up the times you’ve wasted rather than working. That will tell you what procrastinating or being non-productive is costing you!

Write that time down on a sticky note, and periodically update it. Like that, you can see the progress you’re making as you strive to become more productive.

Conclusion

These then, are 3 effective techniques you can use to increase your productivity. They will help you to improve yourself as a freelancing web designer:

Let Be Theme help you create websites in as little as 4 hours (or less)

Do not work to strictly-segmented schedules or detailed to-do lists. Instead, be more flexible in your approach to your work

Calculate how much procrastination is costing you. You’ll quickly become motivated to do something about it

What is the best part of these techniques? They don’t force you into a productivity-boosting stratagem. You are free to choose whichever path suits you or your lifestyle better.


Collective #382

Original Source: http://feedproxy.google.com/~r/tympanus/~3/h1ZR9xbsr48/

C382_Be

Our Sponsor
300+ pre-built websites with a 1 click installation

Be Theme has more than 300 pre-built websites. Pick a pre-built website, install it with the most intuitive installer ever and easily edit it.

Explore more

C382_designmockupscode

Turning Design Mockups Into Code With Deep Learning

Emil Wallner shows how Deep Learning can be used to automatically create markup from design mockups.

Read it

C382_addy

JavaScript Start-up Optimization

Addy Osmani writes how to employ a little discipline for your site to load and be interactive quickly on mobile devices.

Check it out

C382_emojis

The Making of Apple’s Emoji: How designing these tiny icons changed my life

Read Angela Guzman’s fascinating story about designing the epic emojis.

Read it

C382_risingstars

2017 JavaScript Rising Stars

See which GitHub projects were the most popular ones by added stars in 2017.

Check it out

C382_faqs

No More FAQs: Create Purposeful Information for a More Effective User Experience

An interesting article on the problematic of FAQs. By Lisa Wright.

Read it

C382_hooks

Hooks Data

With this API you can get updates as webhooks on thousands of topics when something important happens.

Check it out

C382_robust

Robust Client-Side JavaScript

A developer’s guide to robust JavaScript and how to achieve it. By Mathias Schäfer.

Read it

C382_smartphone

Your smartphone is making you stupid, antisocial and unhealthy. So why can’t you put it down?

A very interesting read on how digital distraction is damaging our minds. By Eric Andrew-Gee.

Read it

C382_character

Gentleman Character Generator (AI, PNG, SVG)

A great character generator perfect for profile images made by Kavoon and available on Pixel Buddha.

Get it

C382_headlesswp

Off with their heads. Building a headless WordPress to manage content.

Drew Dahlman shows how to use WordPress as a headless CMS for publishing static JSON.

Read it

C382_fontrapid

FontRapid

An interesting plugin that lets you design and create fonts directly in Sketch.

Check it out

C382_polka

Polka

Polka is an Express.js alternative micro web server that is very fast.

Check it out

C382_sketchicon

Sketch Icons

Import icons into Sketch and automatically apply a color mask with this great plugin. Read more about it in this article.

Check it out

C382_accessibility

Small Tweaks That Can Make a Huge Impact on Your Website’s Accessibility

Andy Bell shares some practical and useful tips for better accessibility.

Read it

C382_handdigital

Free Font: HandDigital

Jason Forrest created this unique looking font.

Get it

C382_mockups

The Mockup Club

A place to find free, high-quality mockups for your projects.

Check it out

C382_12

J.A.R.V.I.S.

J.A.R.V.I.S. (Just A Rather Very Intelligent System) will put all the relevant information you need from your Webpack build in your browser.

Check it out

C382_vrplus

XR.+

Publish and share 3D models in AR and VR for the browser.

Check it out

C382_ssl

Free static websites with SSL for hackers

A tutorial that shows how to set up a free static website with custom domains and SSL. By Rodrigo López Dato.

Read it

C382_cierge

Cierge

Cierge is an open source authentication server (OIDC) that handles user signup, login, profiles, management, and more.

Check it out

C382_skia

Skia Graphics Library

In case you didn’t know about it: Skia is an open source 2D graphics library which provides common APIs that work across a variety of hardware and software platforms.

Check it out

C382_letteranimations

From Our Blog
Decorative Letter Animations

Some decorative shape and letter animations based on the Dribbble shot “Us By Night” by Animography.

Check it out

Collective #382 was written by Pedro Botelho and published on Codrops.

Evil Icons – A Clean SVG Line Icon Pack for Web Developers

Original Source: https://www.hongkiat.com/blog/evil-icons-svg-iconset/

With a name like Evil Icons, you might not be sure what to expect. But, the project is harmless and surprisingly useful! The Evil Icons pack offers an assortment of a few dozen icons in the line icon…

Visit hongkiat.com for full content.

Debugging JavaScript with the Node Debugger

Original Source: https://www.sitepoint.com/debugging-javascript-node-debugger/

It’s a trap! You’ve spent a good amount of time making changes, nothing works. Perusing through the code shows no signs of errors. You go over the logic once, twice or thrice, and run it a few times more. Even unit tests can’t save you now, they too are failing. This feels like staring at an empty void without knowing what to do. You feel alone, in the dark, and starting to get pretty angry.

A natural response is to throw code quality out and litter everything that gets in the way. This means sprinkling a few print lines here and there and hope something works. This is shooting in pitch black and you know there isn’t much hope.

You think the darkness is your ally

Does this sound all too familiar? If you’ve ever written more than a few lines of JavaScript, you may have experienced this darkness. There will come a time when a scary program will leave you in an empty void. At some point, it is not smart to face peril alone with primitive tools and techniques. If you are not careful, you’ll find yourself wasting hours to identify trivial bugs.

The better approach is to equip yourself with good tooling. A good debugger shortens the feedback loop and makes you more effective. The good news is Node has a very good one out of the box. The Node debugger is versatile and works with any chunk of JavaScript.

Below are strategies that have saved me from wasting valuable time in JavaScript.

The Node CLI Debugger

The Node debugger command line is a useful tool. If you are ever in a bind and can’t access a fancy editor, for any reason, this will help. The tooling uses a TCP-based protocol to debug with the debugging client. The command line client accesses the process via a port and gives you a debugging session.

You run the tool with node debug myScript.js, notice the debug flag between the two. Here are a few commands I find you must memorize:

sb(‘myScript.js’, 1) set a breakpoint on first line of your script
c continue the paused process until you hit a breakpoint
repl open the debugger’s Read-Eval-Print-Loop (REPL) for evaluation

Don’t Mind the Entry Point

When you set the initial breakpoint, one tip is that it’s not necessary to set it at the entry point. Say myScript.js, for example, requires myOtherScript.js. The tool lets you set a breakpoint in myOtherScript.js although it is not the entry point.

For example:

// myScript.js
var otherScript = require(‘./myOtherScript’);

var aDuck = otherScript();

Say that other script does:

// myOtherScript.js
module.exports = function myOtherScript() {
var dabbler = {
name: ‘Dabbler’,
attributes: [
{ inSeaWater: false },
{ canDive: false }
]
};

return dabbler;
};

If myScript.js is the entry point, don’t worry. You can still set a breakpoint like this, for example, sb(‘myOtherScript.js’, 10). The debugger does not care that the other module is not the entry point. Ignore the warning, if you see one, as long as the breakpoint is set right. The Node debugger may complain that the module hasn’t loaded yet.

Time for a Demo of Ducks

Time for a demo! Say you want to debug the following program:

function getAllDucks() {
var ducks = { types: [
{
name: ‘Dabbler’,
attributes: [
{ inSeaWater: false },
{ canDive: false }
]
},
{
name: ‘Eider’,
attributes: [
{ inSeaWater: true },
{ canDive: true }
]
} ] };

return ducks;
}

getAllDucks();

Using the CLI tooling, this is how you’d do a debugging session:

> node debug debuggingFun.js
> sb(18)
> c
> repl

Continue reading %Debugging JavaScript with the Node Debugger%