Migrating sermons from Sermon Manager for WordPress to SermonAudio

I build a Laravel-based command-line utility to import sermons from the Sermon Manager for WordPress plugin and migrate them into SermonAudio.

If it’s useful to you, see this repository for setup and usage details: https://gitlab.com/andrewminion/sermon-manager-to-sermon-audio

Trello to Excel

I was trying to export a Trello board to a spreadsheet and include all the cards and checklists but couldn’t find a good way to do that, so I wrote one!

Originally this project was based on Laravel Zero, a command-line Laravel framework. It accepted a JSON file exported from Trello and exports an Excel spreadsheet:

  • A board becomes an Excel file
  • Each list becomes a worksheet
  • Each card becomes a row in the worksheet
  • Checklist items become individual rows with their name, completion status, and due date

It still does that, but it’s also available now as a webapp for anybody to use simply by logging in with Trello!

Try it out here: https://trello-to-excel.andrewrminion.com/

You can find the source code here: https://gitlab.com/andrewminion/trello-to-excel

Example

Counting Distinct Values in a Single Field

A quick MySQL snippet to count how many times a value appears in a single field—much easier to grok than multiple JOINs.

SELECT
COUNT(CASE WHEN meta_value = 'value1' THEN 1 END) AS value1,
COUNT(CASE WHEN meta_value = 'value2' THEN 1 END) AS value2
FROM wp_post_meta;

/** Results

| value1 | value2 |
|--------|--------|
| 75     | 56     |
*/

Local Development and WordPress Uploads

One common issue with local development is how to handle uploaded files.

You could copy the entire wp-content/uploads/ directory but that can use up a lot of disk space for little benefit.

Another option is to rewrite all HTTP requests for local images to the appropriate URLs on the live site.

Here’s how to do it:

Nginx

Find your nginx config file1 and add this line in the location / { block2:

rewrite ^/wp-content/uploads/(.*)$ https://{live site domain}/wp-content/uploads/$1;

Apache

Add this line to the .htaccess file:

RewriteRule ^wp-content/uploads/(.*)$ http://{live site domain}/wp-content/uploads/$1 [NC,L]

Notes

  1. If you’re using Laravel Valet, look in ~/.config/valet/Nginx/ for a file with the same name as your site’s domain.
  2. This ideally would be the first line and in any case must come before a line that contains last at the end

Using psysh in Shared Hosting or Limited User Environments

When using psysh or Laravel’s php artisan tinker in a limited user’s environment, you may run into this error:

Unable to create PsySH runtime directory. Make sure PHP is able to write to {some directory path} in order to continue.

This is caused by psysh trying to use a path that’s not accessible to the user.

To fix, add a file at ~/.config/psysh/config.php with this content:

<?php
return [
    'runtimeDir' => '~/tmp'
];

The Color of Compromise

by Jemar Tisby

Description

The Color of Compromise takes readers on a historical journey: from America’s early colonial days through slavery and the Civil War, covering the tragedy of Jim Crow laws and the victories of the Civil Rights era, to today’s Black Lives Matter movement. Author Jemar Tisby reveals the obvious—and the far more subtle—ways the American church has compromised what the Bible teaches about human dignity and equality.

Tisby uncovers the roots of sustained injustice in the American church, highlighting the cultural and institutional tables that need to be turned in order to bring about real and lasting progress between black and white people. Through a story-driven survey of American Christianity’s racial past, he exposes the concrete and chilling ways people of faith have actively worked against racial justice, as well as the deafening silence of the white evangelical majority. Tisby shows that while there has been progress in fighting racism, historically the majority of the American church has failed to speak out against this evil. This ongoing complicity is a stain upon the church, and sadly, it continues today.

Tisby does more than diagnose the problem, however. He charts a path forward with intriguing ideas that further the conversation as he challenges us to reverse these patterns and systems of complicity with bold, courageous, and immediate action. The Color of Compromise provides an accurate diagnosis for a racially divided American church and suggests creative ways to foster a more equitable and inclusive environment among God’s people.

My Thoughts

This was a fairly quick read. Eight of the eleven chapters are a historical overview of racism and slavery in the United States, highlighting the assumptions and actions of both the culture and the church.

The final two chapters examine how the church and Christians are responding to current events, and offers a number of both small and large practical actions that we can take to combat racism.

This is a must-read for anyone in the American church. It is challenging and convicting to understand that doing nothing is to continue being complicit in racial systems.

If you read nothing else, at least read these two quotes:

Black lives matter does not mean that only black lives matter; it means that black lives matter too. Given the racist patterns of devaluing black lives in America’s past, it is not obvious to many black people that everyone values black life.

— Location 3,084

[M]any evangelicals have distanced themselves from or even opposed both the Black Lives Matter organization and the phrase. But the American evangelical church has yet to form a movement as viable and potent that addresses the necessary concept that black lives do indeed matter.

— Location 3,101, emphasis added

Quotes

One of the challenges we face in discussions of racism today is that the conversation about race has shifted since the civil rights era. Legislation has rendered the most overt acts of racism legally punishable. Hate crimes of various forms still occur, but most American Christians would call these acts evil. Yet the legacy of racism persists, albeit in different forms.

— Location 2,993

Sociologists Michael Emerson and Christian Smith studied white evangelical ideas about race in their book Divided by Faith. To frame their study, they used the concept of a “racialized” society which they defined as a society “wherein race matters profoundly for differences in life experiences, life opportunities and social relationships.”

— Location 2,996

Emerson and Smith go on to explain that discrimination in a racialized society is increasingly covert, embedded in the normal operations of institutions, and it avoids direct racial terminology, making it invisible to most white people.

— Location 3,001

Black lives matter does not mean that only black lives matter; it means that black lives matter too. Given the racist patterns of devaluing black lives in America’s past, it is not obvious to many black people that everyone values black life.

— Location 3,084

[M]any evangelicals have distanced themselves from or even opposed both the Black Lives Matter organization and the phrase. But the American evangelical church has yet to form a movement as viable and potent that addresses the necessary concept that black lives do indeed matter.

— Location 3,101, emphasis added

Many Christians may agree with the principle that black lives matter, but they still wonder whether they should get involved with an organization that espouses beliefs contrary to his or her religious convictions. There is no single answer that will fit every person’s situation. … Ultimately, the organizations with which one chooses to affiliate in the cause of antiracism is a matter of conscience. The only wrong action is inaction.

— Locations 3,168–3,174

Christian complicity with racism in the twenty-first century looks different than complicity with racism in the past. It looks like Christians responding to black lives matter with the phrase all lives matter. It looks like Christians consistently supporting a president whose racism has been on display for decades. It looks like Christians telling black people and their allies that their attempts to bring up racial concerns are “divisive.” It looks like conversations on race that focus on individual relationships and are unwilling to discuss systemic solutions. Perhaps Christian complicity in racism has not changed much after all. Although the characters and the specifics are new, many of the same rationalizations for racism remain.

— Location 3,291

If the twenty-first century is to be different from the previous four centuries, then the American church must exercise even more creativity and effort to break down racial barriers than it took to erect them in the first place.

— Location 3,318

View on Bookshop


Note: this is an affiliate link, so I may get a small commission if you purchase using the link. This commission does not affect the content of this post.

Dune Series

Frank Herbert wrote Dune in 1965, beginning a series of other novels and books set in the same universe.

It’s science fiction, but doesn’t dive into deep technical aspects as much as some other series do. The first two books are set on the desert planet of Arrakis, which is the sole source of melange, a highly-prized spice in the universe.

I’ve thoroughly enjoyed this series so far. It combines light technical detail, human relationships and social dynamics, and occasionally includes nuggets of wisdom like the quotes below.

Dune

Cover of Dune

Set on the desert planet Arrakis, Dune is the story of the boy Paul Atreides, heir to a noble family tasked with ruling an inhospitable world where the only thing of value is the “spice” melange, a drug capable of extending life and enhancing consciousness. Coveted across the known universe, melange is a prize worth killing for….

When House Atreides is betrayed, the destruction of Paul’s family will set the boy on a journey toward a destiny greater than he could ever have imagined. And as he evolves into the mysterious man known as Muad’Dib, he will bring to fruition humankind’s most ancient and unattainable dream.

A stunning blend of adventure and mysticism, environmentalism and politics, Dune won the first Nebula Award, shared the Hugo Award, and formed the basis of what is undoubtedly the grandest epic in science fiction.

Quotes

“When religion and politics travel in the same cart, the riders believe nothing can stand in their way. Their movement becomes headlong—faster and faster and faster. They put aside all thought of obstacles and forget that a precipice does not show itself to the man in a blind rush until it’s too late.”

— Location 7,089

View on Bookshop

Dune Messiah

Dune Messiah continues the story of Paul Atreides, better known—and feared—as the man christened Muad’Dib. As Emperor of the known universe, he possesses more power than a single man was ever meant to wield. Worshipped as a religious icon by the fanatical Fremen, Paul faces the enmity of the political houses he displaced when he assumed the throne—and a conspiracy conducted within his own sphere of influence.

And even as House Atreides begins to crumble around him from the machinations of his enemies, the true threat to Paul comes to his lover, Chani, and the unborn heir to his family’s dynasty…

Quotes

When a creature has developed into one thing, he will choose death rather than change into his opposite.

— Location 2,247

View on Bookshop


Note: these are affiliate links, so I may get a small commission if you purchase using these links. This commission does not affect the content of this post.

The Warmth of Other Suns: The Epic Story of America’s Great Migration

Description

Cover image of The Warmth of Other Suns - The Epic Story of America's Great Migration

From 1915 to 1970, this exodus of almost six million people changed the face of America. Wilkerson compares this epic migration to the migrations of other peoples in history. She interviewed more than a thousand people, and gained access to new data and official records, to write this definitive and vividly dramatic account of how these American journeys unfolded, altering our cities, our country, and ourselves.

With stunning historical detail, Wilkerson tells this story through the lives of three unique individuals: Ida Mae Gladney, who in 1937 left sharecropping and prejudice in Mississippi for Chicago, where she achieved quiet blue-collar success and, in old age, voted for Barack Obama when he ran for an Illinois Senate seat; sharp and quick-tempered George Starling, who in 1945 fled Florida for Harlem, where he endangered his job fighting for civil rights, saw his family fall, and finally found peace in God; and Robert Foster, who left Louisiana in 1953 to pursue a medical career, the personal physician to Ray Charles as part of a glitteringly successful medical career, which allowed him to purchase a grand home where he often threw exuberant parties.

Wilkerson brilliantly captures their first treacherous and exhausting cross-country trips by car and train and their new lives in colonies that grew into ghettos, as well as how they changed these cities with southern food, faith, and culture and improved them with discipline, drive, and hard work. Both a riveting microcosm and a major assessment, The Warmth of Other Suns is a bold, remarkable, and riveting work, a superb account of an “unrecognized immigration” within our own land. Through the breadth of its narrative, the beauty of the writing, the depth of its research, and the fullness of the people and lives portrayed herein, this book is destined to become a classic.

My Thoughts

I thought this book was excellent. Far from a dry examination of events and causes, it began with some historical context and examples of life under Jim Crow laws in the South.

It picks up the stories of three specific individuals and follows them through life, starting with their decision to leave their homeland in the South and migrate to the North to have the freedom they were promised by their country.

The narrative jumps between the characters, but rather than keeping the chronological timeline strictly coherent, it tracks their life progress. For instance, the chapter describing when they left is set in three different decades.

One thing that really struck me is just how recently Jim Crow laws were enforced, resulting in—for all practical intents and purposes—the continuation of slavery.

Quotes

An invisible hand ruled their lives and the lives of all the colored people in Chickasaw County and the rest of Mississippi and the entire South for that matter. …[T]here was mostly fear and dependence—and hatred of that dependence—on both sides.

— Page 43

Across the South, someone was hanged or burned alive every four days from 1889 to 1929, according to the 1933 book The Tragedy of Lynching, for such alleged crimes as “stealing hogs, horse-stealing, poisoning mules, jumping labor contract, suspected of killing cattle, boastful remarks” or “trying to act like a white person.” Sixty-six were killed after being accused of “insult to a white person.” One was killed for stealing seventy-five cents.

— Page 53, emphasis added

Jim Crow had a way of turning everyone against one another, not just white against black or landed against lowly, but poor against poorer and black against black for an extra scrap of privilege.

— Page 63

The dance of the compliant sharecropper conceding to the big planter year in and year out made it seem as if the ritual actually made sense, that the sharecropper, having been given no choice, actually saw the tilted scales as fair. The sharecropper’s forced silence was part of the collusion that fed the mythology.

— Page 198

The South, totalitarian and unyielding, was at that very moment succeeding at what white Harlem leaders were so desperately trying to do, that is, controlling the movements of blacks by controlling the minds of whites.

— Page 288

Contrary to modern-day assumptions, for much of the history of the United States—from the Draft Riots of the 1860s to the violence over desegregation a century later—riots were often carried out by disaffected whites against groups perceived as threats to their survival. Thus riots would become to the North what lynchings were to the South, each a display of uncontained rage by put-upon people directed toward the scapegoats of their condition. Nearly every big northern city experienced one or more during the twentieth century.

— Page 314

The reality was that Jim Crow filtered through the economy, north and south, and pressed down on poor and working-class people of all races. The southern caste system that held down the wages of colored people also undercut the earning power of the whites around them, who could not command higher pay as long [as there were colored people willing to do the same jobs].

— Page 363

[T]he sociologist Gunnar Myrdal called [this] the Northern Paradox: In the North, Myrdal wrote, “almost everybody is against discrimination in general, but, at the same time, almost everybody practices discrimination in his own personal affairs”—that is, by not allowing blacks into unions or clubhouses, certain jobs, and white neighborhoods, indeed, avoiding social interaction overall. “It is the culmination of all these personal discriminations,” he continued, “which creates the color bar in the North, and, for the Negro, causes unusually severe unemployment, crowded housing conditions, crime and vice. About this social process, the ordinary white Northerner keeps sublimely ignorant and unconcerned.”

— Page 441

The hierarchy in the North “called for blacks to remain in their station,” Lieberson wrote, while immigrants were rewarded for “their ability to leave their old world traits” and become American as quickly as possible.

— Page 475

With the benefit of hindsight, the century between Reconstruction and the end of the Great Migration perhaps may be seen as a necessary stage of upheaval. It was a transition from an era when one race owned another; to an era when the dominant class gave up ownership but kept control over the people it once had owned, at all costs, using violence even; to the eventual acceptance of the servant caste into the mainstream.

— Page 608

Perhaps it is not a question of whether the migrants brought good or ill to the cities they fled to or were pushed or pulled to their destinations, but a question of how they summoned the courage to leave in the first place or how they found the will to press beyond the forces against them and the faith in a country that had rejected them for so long. By their actions, they did not dream the American Dream, they willed it into being by a definition of their own choosing. They did not ask to be accepted but declared themselves the Americans that perhaps few others recognized but that they had always been deep within their hearts.

— Page 608

View on Bookshop


Note: this is an affiliate link, so I may get a small commission if you purchase using the link. This commission does not affect the content of this post.

Using Laravel artisan tinker and psysh with Xdebug

I often use Xdebug for troubleshooting and interactively debugging local code as I write it.

Laravel’s artisan command is extremely useful for running code interactively during development. (It’s based on another utility named psysh.)

It can be very useful to set some debug breakpoints and then run code interactively using artisan, but occasionally when I run php artisan tinker, the PHP shell just sits there and doesn’t accept any input until I kill my xdebug listener.

Thanks to this issue, I finally have a solution.

Add this to the psysh config file (~/.config/psysh/config.php on macOS):

<?php
return [
  'usePcntl' => false,
];

VS Code and Laravel Tasks

Several of my recent projects are Laravel apps that use Horizon to manage the queue and run jobs.

However, I frequently forgot to run php artisan horizon when opening the project, and sometimes spent a bit of time trying to figure out why a job hadn’t run before remembering. 🤦

In addition—and this is a relatively minor annoyance—even when I do remember to start Horizon, sometimes I’d like to see the metrics dashboard showing how many jobs have run in the past few minutes.

Edit: I added npm run watch to help with Tailwind JIT mode.

Workspace Tasks

Enter VS Code’s Tasks feature. This can automatically start running tasks when a workspace is opened.

To get set up:

  1. Open the command palette (command-shift-P) and activate “Tasks: Manage Automatic Tasks in Folder”
  2. Activate “Allow Automatic Tasks in Folder”
  3. Open the command palette again and activate “Tasks: Open Workspace Tasks”
  4. Add the following to the workspace:

Now every time I open the workspace, assets are rebuilt as I modify them and Horizon and the scheduler run automatically.