24 WordPress Snippets ’til Christmas, Submissions Open for 2019

Screenshot of the WP snippets 'til Christmas website.

After a multi-year hiatus, Elliott Richmond has relaunched his WordPress advent calendar and is looking for volunteers. The WP Snippets ’til Christmas site will host 24 days of WordPress code snippets starting on December 1 and lasting until December 24. With each passing day, a new code snippet will be revealed.

Advent calendars are special types of calendars used to count down the days until Christmas. They are often a part of religious celebrations but can be used for other purposes such as family traditions and games. For Richmond’s advent calendar, it is a way to contribute something back to the WordPress community.

Richmond opened the site for developers to make contributions to the 24-day event. “I’ve been in touch with the original contributors in the hope that they’ll submit again and registration is also open to anyone else who wishes to contribute,” he said. “Otherwise, it will just be the Elliott Richmond show.”

He would rather have community submissions than attempting to write all 24 code snippets alone. Jeff Starr, Zac Gordon, and Tom McFarlin, all prominent developers in the WordPress community, have already signed on to submit code. Author’s note: I am also considering joining because it sounds like fun.

Anyone who wants to receive updates each day of the event can register for free on the WP Snippets ’til Christmas website. The same signup form is available for contributors.

There are no limitations on the types of code snippets that contributors can submit, only that they should be related to WordPress. Richmond says he has some ideas such as a WP-CLI script and a deployment tool for use on the command line. However, code snippets can be something as simple as sticking a basic function into a theme to more complex scripts.

“I come from a frontend world and I’m a self-taught PHP developer,” said Richmond. “I’m evolving constantly and always eager to learn new things. I think WordPress is similar, it’s always evolving and inspiring innovation. If you put any limitations on things they rapidly become stagnated.”

The code snippets are not aimed at any type of WordPress user in particular. “I think it’s really useful to see bite-size code snippets to help those in the community who are taking that next step into development,” said Richmond. “To those more seasoned developers, I think it’s always useful to see how other developers approach things.”

Each code snippet will have an open comments section similar to a traditional blog. This will allow others to say thanks for sharing or to jump-start a conversation.

The Road Back to the Advent Calendar

Richmond has been a WordPress user and developer since the launch of the platform. He is the director of Square One Software, a software development company that specializes in WordPress development.

He last ran the advent calendar in 2013. After the success of the first year in 2012, he decided to put it together for a second round. He wanted to keep it going beyond the first two years, but work and other commitments took priority.

In the years since, Richmond met other local WordPress enthusiasts at WordCamp London. He now helps host the local meetup in Cheltenham, UK. With the help of the community, he organized four teams of local project managers, designers, developers, and content writers for a local do_action event. “I’m still an enthusiastic proponent of giving back to the community and actively encourage others in our local community to share their experience and knowledge,” said Richmond.

do_action events are charity hackathons that use WordPress to help provide local charity organizations an online presence.

“Every single team and team member did an amazing job on the day for four local non-profit charities, putting together a functional WordPress website for each charity while I personally gave a charity representative some hands-on training,” said Richmond. “Taking away some of the overhead of creating a website for the charities allows them to concentrate on what they do best, which is raising money for their own community.”

Richmond described needing to find something to do next while still riding the buzz from the event. That is when he decided to relaunch the WP Snippets ’til Christmas event.


Because it is the season, Richmond crowned “It’s a Wonderful Life” as the greatest Christmas movie.

“I love classics and this one is a true classic, pretty apt in the current move to make people aware of mental health,” said Richmond. “The movie starts with depression and pending suicide when a guardian angel is bestowed to the main character George Bailey. George is shown how many lives he’s impacted on in his own local community and how things would have been if he didn’t exist, a real heartwarming feel-good reflection on the things that we take for granted in our own existence.”

With this upcoming holiday season, considering taking the time to give back to both your local community and the WordPress community. One great way to do that is to contribute a code snippet to WP Snippets ’til Christmas.

Making It Easier to Manage a Production PostgreSQL Database

Manage a Production PostgreSQL Database

The past several years have seen increasing adoption for PostgreSQL. PostgreSQL is an amazing relational database. Feature-wise, it is up there with the best, if not the best. There are many things I love about it — PL/ PG SQL, smart defaults, replication (that actually works out of the box), and an active and vibrant open source community. However, beyond just the features, there are other important aspects of a database that need to be considered.

If you are planning to build a large 24/7 operation, the ability to easily operate the database once it is in production becomes a very important factor. In this aspect, PostgreSQL does not hold up very well. In this blog post, we will detail some of these operational challenges with PostgreSQL. There is nothing fundamentally unfixable here, just a question of prioritization. Hopefully, we can generate enough interest in the community to prioritize these features.

How AI-Powered Computer Vision Is Transforming Healthcare

AI-Powered Computer Vision

The impact of AI on human lives can be felt the most in the healthcare industry. AI-powered computer vision technology can help bring affordable healthcare to millions of people. Computer vision practices are already in place for sorting and finding images in blogs and retail websites. It also has applications in medicine.

You may be interested in:  Computer Vision: Overview of a Cutting Edge AI Technology

Medical diagnosis depends on medical images such as CAT scans, MRI images, X-rays, sonograms, and other images.

A Complete Guide To Math And Statistics For Data Science

As Josh Wills once said,

“Data Scientist is a person who is better at statistics than any programmer and better at programming than any statistician.”

Math and Statistics for Data Science are essential because these disciples form the basic foundation of all the Machine Learning Algorithms. In fact, Mathematics is behind everything around us, from shapes, patterns, and colors, to the count of petals in a flower. Mathematics is embedded in each and every aspect of our lives.

Vulnerability in Libarchive Threatens Many Linux Distributions

This summer, Google experts using the ClusterFuzz and OSS-Fuzz tools, discovered a dangerous bug in the Libarchive library, which is responsible for working with archives and compressed files. Libarchive is included by default with Debian, Ubuntu, Gentoo, Arch Linux, FreeBSD, and NetBSD, and the vulnerability allows an attacker to execute arbitrary code on a vulnerable machine. It is reported that Windows and macOS, which also include the library, are not vulnerable.

The bug received the identifier CVE-2019-18408 and allows the attacker to execute arbitrary code in the system using a specially created archive file. The problem can be exploited through a malicious file obtained from cybercriminals through local applications that use various Libarchive components in their work.

A Developer’s Guide to Modex BCDB

Modex BCDB is an application which intervenes in the development stack by positioning itself between the database and the existing application server. In a classical flow scheme, the front end application makes API calls to an application server, which in turn makes calls to the database. Most often, these interactions are represented by the standard CRUD operations performed in a database.

Modex BCDB is a hybrid solution that acts as a liaison between a client’s database and a blockchain network. After implementing our solution, insert commands still follow the paradigm of classic database systems, but each data entry passes through a hashing function that produces a unique hash that is stored into the blockchain to ensure data integrity and transform a centralized system into a decentralized one. In essence, a user maintains its data structure at the database level but gains access to all of the advantages of blockchain technology by storing its hash in a blockchain.

How to Build a Serverless App With Vue, Azure Functions and FaunaDB Part 1

We don't be needing this in this tutorial

Serverless Functions/APIs are best used when building static websites. Static websites are still relevant in many purposes, including a company portfolio page, meetup group page, product pages, or blogs, to name a few.

When developing such apps, the use of a full-blown backend API (ASP.NET, Node.js, PHP) is excessive and unnecessary. Usually, your app performs simple tasks, such as sending out a few emails, handling form submission, and managing a few records in a database.

JAMstack CMSs Have Finally Grown Up!

This article is based on Brian's presentation at Connect.Tech 2019. Slides with speaker notes from that presentation are available to download.

In my experience, developers generally find the benefits of the JAMstack easy to comprehend. Sites are faster because the resources are static and served from a CDN. Sites are more secure because there is no framework, application server or database to compromise. Development and deployment can be optimized because all of the pieces that make up the stack are unbundled. And so on.

What can be more difficult for developers to comprehend are the trade-offs that this can often require for the folks who create and edit content. Traditional, monolithic content management systems have often been ridiculed by developers (yes, even WordPress) who became frustrated trying to bend the tool to their will in order to meet project requirements. But, until recently, the JAMstack largely just passed that burden onto the non-technical content creators and editors.

By developers, for developers

Static site generators (i.e. tools like Jekyll, Hugo and Gatsby) grew enormously in popularity in large part because developers adopted them for projects. They became common solutions for things like blogs, documentation or simple static pages. By and large, these were sites created by developers, maintained by developers and with the content primarily written and edited by developers.

When I first wrote about these tools in a report for O'Reilly in 2015, this is what I said:

Just in case this isn’t already clear, I want to emphasize that static site generators are built for developers. This starts with the development of the site all the way through to adding content. It’s unlikely that non-developers will feel comfortable writing in Markdown with YAML or JSON front matter, which is the metadata contained at the beginning of most static site engine content or files. Nor would non- technical users likely feel comfortable editing YAML or JSON data files.

—Me (Static Site Generators report for O'Reilly 2015)

When, two years later, I wrote a book for O'Reilly on the topic (with my friend Raymond Camden), not too much had changed. There were some tools at the very early stages, including Jekyll Admin and Netlify CMS, but they had not matured to a point that they could realistically compete with the sort of WYSIWYG tooling that content editors were used to in tools like WordPress.

The WordPress editor showing a field for the post title and a text area for the post content.
The WordPress editing experience

By contrast, the editing experience of static CMSs still required an understanding of Markdown and other markup (YAML, Liquid, etc.).

An editing screen in Netlify showing post fields on the left and a preview of the post on the right.
The Netlify CMS editing experience in 2017

Suffice it to say, whatever the technical merits of the architecture at the time, from a content editing standpoint, this was not a toolset that was ready for mainstream adoption.

The awkward teenage years

Over the ensuing two years, a combination of a couple of trends started to make the JAMstack a viable solution for mainstream content sites with non-technical editors. The first was that the static CMS matured into what we now generally refer to as git-based CMS solutions. The second was the rise of the headless, API-first CMS as a solution adopted by enterprises.

Let's take a look at the first trend... well... first. Netlify CMS, an open-source project from Netlify, is an example of a git-based CMS. A git-based CMS doesn't store your content, as a traditional CMS would, but it has tools that understand how to edit things like Markdown, YAML, JSON and other formats that make up a JAMstack site. This gives the content editors tools they feel comfortable with, but, behind the scenes, their content changes are simply committed back into the repository, forcing a rebuild of the site. While Netlify CMS is installed on the site itself, other popular git-based CMS options are web-based, including Forestry and DatoCMS.

An editing screen in Netlify from 2017 showing post fields on the left and a preview of the post on the right.
The current editing experience in Netlify CMS

The headless, API-first CMS functions much more like the editing experience in a traditional CMS. It not only offers tools for creating and editing content, but it stores that content. However, it makes that content available to the front end - any front-end - via an API. While not limited to JAMstack in any way, an API-first CMS works well with it because the creation and management of the content is separate from the display of that content on the front end. In addition, many API-first CMSs offer pre-built integrations with some of the most widely used static site generators. Popular API-first options include Contentful and Sanity.

The Contentful admin, showing post fields on the left and post settings on the right.
Contentful

HeadlessCMS.org is a site maintained by Netlify that has a comprehensive list of all the available tools, both git-based and API-first. For a good look at the differences, pros and cons between choosing a git-based versus an API-first CMS, check out this post by Bejamas.

Both git-based and API-first headless CMS options began to give non-technical content editors the tools they needed on the backend to create content. The awkwardness of these "teenage years" comes from the fact that the tooling is still disconnected from the frontend. This makes it difficult to see how changes you've made in the backend will impact the frontend until those changes are actually committed to the repo or pushed live via the API. Add in the time cost of a rebuild and you have a less than ideal editing experience where mistakes can more easily make it to the live site.

A Look at the future

So what does the future look like when the JAMstack CMS is finally grown up? Well, we got a good look at this year's JAMstack_conf_sf. Coincidentally, there were two presentations demonstrating new tools that are bringing the content editing experience to the frontend, letting content editors see what they are changing, how their changes will look and how they will impact the layout of the site.

The first presentation was by Scott Gallant of Forestry. In it, he introduced an new open source projects from Forestry called TinaCMS that brings a WYSIWYG style content editing experience to the frontend of sites that use a git-based CMS and Gatsby or Next.js (both React-based tools).

Animated flow for editing a page on the front end with Tina CMS.
TinaCMS

The second presentation was by Ohad Eder-Pressman of Stackbit (full disclosure: I work as a Developer Advocate for Stackbit) that introduced an upcoming set of tools called Stackbit Live. Stackbit Live is designed to be CMS and static site generator agnostic, while still allowing on-page editing and previewing of a JAMstack site.

Animation of editing a page on the front end with Stackbit Love
Stackbit Live

What both these tools demonstrated is that we're at a point where a "JAMStack + headless" architecture is a real alternative to a traditional CMS. I believe we've reached the tipping point whereby we're no longer trading a great developer experience for an uncomfortable editing experience for content authors. By 2020, JAMstack CMS will officially be all grown up. 👩🏽‍🎓

The post JAMstack CMSs Have Finally Grown Up! appeared first on CSS-Tricks.

API Security Weekly: Issue #57

API Security News

This week we look at the recent API vulnerabilities at Facebook, Amazon Ring, and GitHub. There is also an upcoming webinar on OWASP API Security Top 10 that you can attend.

You may also like:  How to Secure APIs

Vulnerability: Facebook

Facebook has reported and fixed a vulnerability in its Groups API. This API and the information it exposes had been potentially abused by about 100 partners after Facebook introduced stricter conditions.

Build and Push a Container Image from Source Code With S2I

Create an image right from your source code with this tool.

Recently, while drafting an OpenShift solution tutorial, I explored an interesting tool called S2I (Source-to-Image). In this post, you will learn how to create a container image directly from your source code and push the generated container image to a private IBM Cloud Container registry.

You may also enjoy:  How to Create a Builder Image With S2I 

What is S2I (Source-to-Image)?

S2I is a tool for building reproducible, Docker-formatted container images. It produces ready-to-run images by injecting application source into a container image and assembling a new image. The new image incorporates the base image (the builder) and built source and is ready to use with the docker run   command. S2I supports incremental builds, which reuses previously downloaded dependencies, previously built artifacts, etc.

How to Monitor Active Directory With Google Stackdriver

DirectoryConfirgure Google Stackdriver and Bindplane to monitor your Active Directory

What is Active Directory?

Active Directory stores information about objects handled on a network and makes it easy for admins and other users to access and utilize the data. When using the Active Directory Domain Service (AD DS) on a server, you get a domain controller. A domain controller automatically authenticates and authorizes all of the devices and users on the network, easily assigning and enforcing the security policies. Active Directory also includes the ability to create a schema that allows you to define classes and constraints for objects and attributes that are found in the directory. Another useful tool that can be found in AD is the replication service that distributes the directory data across the network.