WPForms: Force Async Scripts

This little plugin has one job: make WPForms’ Google Recaptcha script load asynchronously.

Get the plugin on GitHub.

Installation Instructions

  1. Copy the wpforms-recaptcha-async.php file to your wp-content/plugins/ directory (or compress to a zip file and upload in the WordPress backend “Plugins > Add New”
  2. Activate
  3. That’s it. All the merged scripts will be loaded with the async and defer attributes.

Merge + Minify + Refresh: Force Async Scripts

This little plugin has one job: make all merged scripts produced by the Merge + Minify + Refresh plugin load asynchronously.

Get the plugin on GitHub.

Installation Instructions

  1. Copy the merge-minify-refresh-async.php file to your wp-content/plugins/ directory (or compress to a zip file and upload in the WordPress backend “Plugins > Add New”
  2. Activate
  3. That’s it. All the merged scripts will be loaded with the async attribute.

Infusionsoft to Shopify Customer History Migration

A helper utility to copy Infusionsoft contacts and their order history to Shopify, ignoring Infusionsoft contacts who do not have orders associated with their contact ID.

It also optionally pulls info from a WooCommerce installation.

Get the code from the GitHub repository. Continue reading “Infusionsoft to Shopify Customer History Migration”

The Second Machine Age by Erik Brynjolfsson and Andrew McAfee

I recently finished reading The Second Machine Age: Work, Progress, and Prosperity in a Time of Brilliant Technologies by Erik Brynjolfsson and Andrew McAfee and it left me with quite a bit to think about.

The premise of the book is that while the first machine age used the “forces of energy trapped in chemical bonds” to release us from the limits of muscle power, the technologies we have as part of the second machine age are doing the same for mental power.

Comparison between the Machine Ages

The first machine age was all about mechanization: discovering how to use (primarily) chemical reactions to produce mechanical power, freeing us from the limits imposed by muscle power (both human and animal). This greatly expanded our boundaries of time and space, allowing us to travel much further and faster that was previously possible, as well as increasing our production capability.

The second machine age is about knowledge and information: using electronic methods to extend our communication and mental capabilities. Computers with their essentially-infinite storage capacity and near-instantaneous communication speeds allow us to “remember” anything at any time without actually storing it in our brains, and we can easily communicate with other people at different geographic or temporal locations.

Dangers of the Digital Age

While modern technology absolutely brings benefits, we should beware of its dangers as well. The authors noted “The Industrial Revolution was accompanied by soot-filled London skies and horrific exploitation of child labor. What will be their modern equivalent? Rapid and accelerating digitization is likely to bring economic rather than environmental disruption. … Technological progress is going to leave behind some people, perhaps even a lot of people, as it races ahead. … Over time, the people of England and other countries concluded that some aspects of the Industrial Revolution were unacceptable and took steps to end them (democratic government and technological progress both helped with this).” (pages 10–11).

Characteristics of the Digital Age

A few key characteristics of technological progress include these:

Exponential

Moore’s Law and similar software improvement capabilities illustrate how the speed of change is accelerating.

Digital

Digital information is “non-rival” (not “used up” when accessed) and has a near-zero cost of reproduction (it’s extremely cheap to make another copy).

Combinatorial

General-purpose technologies (like a typical computer, general command-line utilities, etc.) have become pervasive and enable a huge number of new inventions when combined in new and interesting ways.

Wealth and Production

The authors note that in the first machine age, the wealthiest individuals were those who owned and controlled tangible assets—such as factories and means of production—while the less-skilled workers (those who actually did the work) did not fare as well.

They believe that production in the second machine age depends on these four intangible assets:

  • Intellectual property (patents, copyrights, research and development, etc.)
  • Organization capital (business practices, business models, etc.)
  • User-generated content (Facebook posts, etc.)
  • Human capital (skilled employees, etc.)

They draw the conclusion that as in the first machine age, those who control the capital will become increasingly more wealthy and powerful.

Economics

The authors discuss the trend of first-to-market and/or top-quality sellers capturing a huge share of the market (a much larger market share than is typical in physical product markets), mostly due to the non-rival and marginal reproductive cost characteristics of digital products. A power law distribution graph (long tail) illustrates this, compared to a normal distribution (bell curve) that previously was typical in markets—both goods markets and labor markets.

Power Law distribution
Power Law (long tail) distribution
Normal distribution
Normal (bell curve) distribution

They believe the characteristics of the digital age will tend to hollow out the middle class for these reasons:

  • There is no large bump in the middle of a power distribution graph; power and wealth is highly concentrated at one end.
  • There is no “average” or “typical” in a power distribution graph.

Where to Go from Here

The authors conclude by examining how humans and computers are likely to interact with each other in the future (spoiler alert: computers and humans are most effective when computers complement or augment humans, rather than replacing them).

They offer several recommendations for individuals:

  • “Improve the skills of ideation/creativity, large-frame pattern recognition, and complex communication” (page 197)
  • “Take advantage of self-organizing learning environments” (page 197)

They also offer a number of policy and long-term recommendations, but you’ll have to read the book for those.

Conclusion

I would definitely recommend anyone in the technical industry especially to read this book, as well as anyone in the position to influence public and education policy.

Buy the book on Amazon

It’s Even Worse Than It Looks: How the American Constitutional System Collided With the Politics of Extremism by Thomas E. Mann and Norman J. Ornstein

It’s Even Worse than It LooksThis 240-page volume by Thomas E. Mann and Norman J. Ornstein seeks to examine the causes for hyper-partisanship, deadlocked Congress, and refusal of the major parties to compromise to accomplish anything significant.

Honestly, this book sounded like it had been written during the 2016 election season rather than in 2012. They did release a second edition in 2016 with some updated information.

Problems

Adversarial Mindset

First, the authors point out that the Republican and Democrat parties have increasingly pointed at each other as adversaries, acting as if it’s “better to have an issue than a bill, to shape the party’s brand name and highlight party differences.” (p51). While undoubtedly this tactic does help win elections, it also limits the ability to accomplish anything.

“The single-minded focus on scoring political points over solving problems, escalating over the last several decades, has reached a level of such intensity and bitterness that the government seems incapable of taking and sustaining public decisions responsive to the existential challenges facing the country.”
—p101

Asymmetric Polarization

The authors coined this term to describe their conclusion that though politics are more polarized than in recent decades, they have not both moved the same distance from center. They argue that the Republican party has moved further to the right and become “more idealogically extreme;… scornful of compromise…; and dismissive of the legitimacy of its political opposition, all but declaring war on the government.” (p102). They don’t hold the Democratic party up as a “paragon of civic virtue” either, but contend that it is more “idealogically centered and diverse,… open to incremental changes in policy fashioned through bargaining with the Republicans, and less disposed to or adept at take-no-prisoners conflict between the parties.” (p102).

Suggestions

To address the hyper-polarized state of current politics, the authors seek parties that are “less idealogically polarized, more accepting of each other’s legitimacy, and more open to genuine deliberation and bargaining on issues of fundamental importance to the future of the country.” (p132, emphasis mine).

Expand the Electorate

Higher voter turnout would bring more moderate voters to the polls, reducing the extreme partisanship shown especially in primary elections.

Reduce Presumed Bias Against Moderates

Reducing gerrymandering, making primaries open or semi-closed instead of completely closed, and instant-runoff voting (ranking candidates in order of preference, rather than picking just one) may help reduce polarization.

Change Campaign Funding and Spending Rules and Practices

Requiring the disclosure of donors and prohibiting contributions from lobbyists and others receiving government money would help make candidates more transparent.

Others

They include several chapters with more suggestions for reducing hyper-polarization and improving honest deliberation and debate, both among citizens and government officials.

Conclusion

No matter your political leanings, you will find something here you do not like, probably because the authors managed to put a finger on something you do not like to acknowledge.

These authors were remarkably prescient; writing in 2012, they made some predictions of what would happen if a Republican government was elected in 2012. In 2017, nearly all of these have taken place already, with more on the horizon:

  • Dismantling health reform
  • Gutting financial regulation
  • Cutting taxes even more
  • Making deep cuts in domestic spending
  • Strong temptation on Mitch McConnell’s part to act unilaterally to erase the filibuster to take advantage of this rare chance to achieve revolutionary change
  • Steep reductions in Medicaid through block grants to the states
  • Partial privatization of Social Security
  • Massive deregulation in finance and environmental policy
  • More than half of the citizens would likely strongly oppose these moves and be jolted by their implementation

(pages 199–200)

I wholeheartedly recommend reading this book and considering what you can do to improve genuine deliberation and debate rather than name-calling, adversarial positions, and blind partisanship.

Buy the book on Amazon

Alexander Hamilton by Ron Chernow

Alexander Hamilton by Ron ChernowAnother tangent from my presidential biographies series…but learning about contemporaries is so interesting!

This 832-page biography goes into great detail about Hamilton’s life and legacy and was the inspiration for the hit Broadway show.

Before reading the book, I knew Hamilton had been the Treasury secretary, but I didn’t realize how much he was actually involved in our country’s formative years. From the Constitution and the Bill of Rights to commerce, the Coast Guard, and support for a strong executive, he managed to influence nearly every aspect of the government.

If you’re interested in US history or early politics, I definitely recommend reading this biography, as it goes into great detail about Hamilton, his politics, contemporaries, and relationships to other founding fathers.

Buy the book on Amazon

Washington and Hamilton: The Alliance That Forged America by Stephen F. Knott

Washington and Hamilton: The Alliance that Forged AmericaA slight tangent from my presidential biographies series, this 352-page volume by Stephen F. Knott examines how Washington and Hamilton worked together and ultimately laid the foundation for banking and commercial success of the United States.

Jefferson’s view that the country should remain primarily an agrarian society stood in direct opposition to Hamilton’s dream of a robust national bank and thriving trade. Probably partly due to Hamilton’s service during the Revolutionary War as Washington’s secretary, and partly due to his prolific writing, he usually managed to get his ideas approved.

Here are a couple of my favorite quotes from the book:

Weak vs. Strong Federal Government

Jefferson, to give him his due, was primarily devoted to liberty, which he believed was best preserved in a simple republic in which the citizenry were truly self-sufficient, and many of Hamilton’s schemes threatened to erode that self-sufficiency. Washington and Hamilton were devoted to liberty but believed that this could be best achieved if Americans thought continentally, moving beyond the parochial and developing more of an attachment to a traditional nation-state.
—Kindle book location 4134

Washington and Hamilton looked at more conventional forms of national power as the surest bulwark of liberty, while Jefferson believed that the character of the citizenry, fostered in an environment of unencumbered liberty, would best protect the American experiment.
—Kindle book location 4140

Results of Washington and Hamilton’s Teamwork

Americans should put aside the caricatured account of their early history that pits the supposed “champions of the people” (Jefferson, Madison, and their party) against the “forces of privilege and authoritarianism” (Washington, Hamilton, and the Federalists). If they do so, they will discover that due to the exertions of George Washington and Alexander Hamilton, the American people began to “think continentally” and created a strong union that decades and then centuries later helped defeat fascism and communism, explored the universe, produced endless scientific and technological breakthroughs, and perhaps most importantly abolished slavery and Jim Crow, thereby securing the blessings of liberty for all of their fellow citizens.
—Kindle book location 4251

Buy the book on Amazon

Listing Unique Font Stacks on a Webpage

I just put together a new tool to list all the unique font stacks on a web page, intended to help with diagnose and remove unnecessary webfonts and save page load time.

Usage

Download this file and include in your page source, or copy-and-paste it into your browser’s JS console, then run the styleInPage() function with the CSS style you want to inspect as the parameter.

Examples

// Show all unique font stacks in use on the current page
console.log(styleInPage('fontFamily'));
// Show a list of all DOM elements with their computed font stack
console.log(styleInPage('fontFamily', true));
// Highlight all DOM elements using font stack 8
var fontStacksInUse = styleInPage('fontFamily');
console.log(fontStacksInUse);
highlightInPage(8);

Washington: A Life by Ron Chernow

Washington: A Life by Ron ChernowI’ve started a new personal reading project: I plan to read a major biography about each of the US Presidents.

Obviously, the first is George Washington.

Washington: A Life written by Ron Chernow is a 930-page volume that thoroughly covers Washington’s life. There were a few things that surprised me a bit—they aren’t part of the typical “Founding Father” narrative in general history books or popular knowledge.

Federalist Leanings

One realization was the extent that Washington’s administration ended up leaning toward the Federalist side. He started out trying to limit executive power and stay within the bounds and intent of the Constitution as written, leaving as much power as possible to the states, but eventually realized the need for a stronger Federal government and took more control.

The author previously wrote a major biography on Alexander Hamilton (who was the definition of Federalist), so perhaps he interpreted some of Washington’s actions from that viewpoint, but Washington was heavily influenced by Hamilton.

Second-Term Attacks

Throughout his first term, the majority of the country practically adored their hero. During his second term, however, the press—especially Phillip Freneau (the National Gazette) and Benjamin Franklin Bache (the Aurora)—fiercely criticized him, even questioning his integrity, motivation for power, and military reputation. At least in my experience of popular history, this has largely been forgotten.

Summary

I highly recommend this book as both a good historical biography and as providing insight into Washington’s character and personality.

Buy the book on Amazon

Unserialize.dev

php iconA quick-and-dirty PHP script to unserialize a string in PHP.

Clone (or download and expand the zip file) into your documents root and point unserialize.dev to the folder.

Note: as of December 2017, Google Chrome requires a TLS certificate to access .dev domains. You can use the script on any local TLD or PHP-capable server without any changes.

Enter your serialized data into the textarea, hit “submit,” and boom!—your serialized data is expanded to a much more human-readable view! Continue reading “Unserialize.dev”