Need quick regex help with matching the same word twice

I need some quick regex help with matching the same word twice in a pattern.

For example, I'm trying to match on the PHP code: if (isset($foo) AND $foo) or if (isset($bar) AND $bar) where $foo and $bar are any valid variable name. However, I don't want to match on if (isset($foo) AND $bar).

Can anyone help me with this? Thanks!!

Struggles of Remote Work Half a Year Into the Pandemic

This was supposed to be the year that ushered in a revolution in how we work. Remote jobs would become a common practice, spurred on by the global COVID-19 pandemic. A time when everyone would start paying attention to those radical ideas from remote work evangelists such as Matt Mullenweg.

The question is whether this pandemic was the catalyst the world needed to reevaluate the workplace.

There is certainly a lot of good we can talk about. No hour-long commutes. Saved money by eating at home instead of takeout from the restaurant across the street. More flexible hours.

As a veteran and evangelist of the remote work movement, I have not dealt with many of the struggles that others have during this stretch. While I have had to adjust to the outside world a bit, for the most part, my day-to-day life has remained the same. I had the knowledge that colleagues, friends, and family were having some growing pains with the new reality. However, I never understood what they were going through.

Last week, I nearly reached my breaking point. It was one of those times where reality decided to check in. The beautiful veneer hanging over a decade of remote work was stripped away. It was a time where I truly understood what others had been going through during this worldwide period of struggle.

One of my housemates tested positive for COVID-19 a week earlier. He had a short battle with a fever a few days before, but that was the scope of sickness within the household. My other two housemates and I tested negative and have been doing fine to this point. As frightening as those few days were (Will my friend be OK? Am I going to get sick?), I was unprepared for what this change meant within our household.

That one little test upended our routines and took its toll on my work life.

It meant two weeks of continual interruptions from people who are not accustomed to being under quarantine. While everyone did their best, it was not an ideal situation. I could hunker down in my own space, but the routine that typically drives my life was shattered. For those of us routine-oriented people, even the smallest interruptions can feel like a freight train chugging by with the sole intent of ruining an otherwise peaceful day.

For most of my professional life, I have worked alone in quiet. I might put on some music or a podcast, mostly as a calming bit of background noise. However, I tend to enjoy being alone with my thoughts and the occasional interruption of a cat jumping in my lap for its daily petting.

The two-week disruption of my life, while unpleasant, was a mere blip in comparison to the struggle that many others have endured and overcome for the past five or six months. However, it has allowed me to become more empathetic when hearing others’ stories. From disruptions on Zoom meetings of children zipping through the house to the family dog begging for playtime in the middle of the day, work has taken on a new meaning for many. And, this is true for remote workers within the WordPress community.

The pandemic has certainly thrust companies and their employees into remote work. However, I question whether it was the push the world needed to reevaluate the workplace. It is not something that grew organically. It forced people into situations they were unprepared for. Some did not miss a beat. Others are still attempting to find balance.

Many of us with years of experience have run into issues. A large portion of the WordPress community works remotely. Some are new to it, and many who have years of experience are learning to cope with changes to their environment.

Mullenweg realizes this is not the best of times, even within an established distributed company such as Automattic. “I believe that if you do distributed work well, you’re a lot more productive,” he said in Corner Office interview for the New York Times. “But the pandemic has affected a lot of people’s lives. School is canceled. People are working from home that might not normally work from home. So we definitely have seen a hit to productivity, not to mention the stress, which has been even compounded by the social unrest.”

I am still an evangelist for remote work. Outside of potentially teaching schoolchildren once again (perhaps in the far, far away future), I can hardly imagine moving to an office away from home anytime soon. However, I can see how being propelled into an unfamiliar environment will not sit well with some. This experience in remote work may even turn away those who would have otherwise been comfortable had they been given the opportunity outside of the chaos of kids, spouses, housemates, and all the other distractions. That old, familiar cubicle may be enticing at this point.

I am happy that this pandemic will make for some converts to remote work but worry that others have not been given a fair look at the benefits that might exist under normal circumstances.

This post is in part sharing my struggles with remote work and part an open invitation for members of our community to talk about their experiences over the past several months. This is me checking in with you, our dear readers. How are you coping today?

For people who are struggling but are not comfortable discussing issues related to remote work openly in the comments, please check out Big Orange Heart, an organization dedicated to supporting the well-being of remote workers.

Convert Reusable Blocks to Block Patterns with 1-Click

Now that WordPress 5.5 has shipped, block patterns are available in core for all users. If you have previously been relying on reusable blocks but prefer the flexibility of block patterns, you may want to convert these.

WordPress core developer Jean-Baptiste Audras has made this possible in the latest update of his Reusable Blocks Extended plugin. He posted a video demo of how the plugin converts reusable blocks to block patterns with one click.

What’s the difference between reusable blocks and block patterns?

Why might you want to convert your reusable blocks to block patterns? For users who are new to the concept, there are a few distinctions between these similar features.

Reusable blocks were designed to be a time-saving feature that allows users to save a block or group of blocks for use on other posts or pages. They can be edited but they have a certain distinction in that they are intended to look the same in all places they are used. Any changes made to a reusable block will apply to all instances of the block wherever it is used.

If a user wanted to make changes to a reusable block specific to one page, the process would involve clicking on the block’s properties and selecting “convert to regular block,” which would ensure that all edits would appear only on that specific instance of the block. It’s unlikely that most users would know how to do this without help, so this is one of the drawbacks of reusable blocks.

Block patterns are predefined block layouts that are designed to be changed. Once a pattern is inserted into the content, users can customize with their own text, images, alignments, colors, additional blocks, etc. The options are limitless and any changes made are not saved back to the original pattern. Block patterns provide a flexible starting point that gives users an idea of how blocks can be combined to make attractive layouts.

User-Created Patterns Are Coming Soon to the Block Pattern Builder Plugin

At the moment, users can create their own reusable blocks but not their own block patterns. Patterns have to be registered with code in order to appear in the pattern library. This is another reason that Audras’ one-click conversion is quite useful for users who are limited to capabilities offered in the editor’s current UI.

The ability to create block patterns inside the editor should be a feature in core. It would enable non-technical users to share their designs and creations in a more flexible format than reusable blocks provide. Until this feature is added to core – and it isn’t a guarantee- there is a plugin for that.

Justin Tadlock’s Block Pattern Builder plugin, which is available on WordPress.org, will soon be merging a pull request that adds the option to create block patterns inside the editor. It will work in a similar way to the process of adding reusable blocks. Now that block patterns are available in WordPress 5.5, this feature will be more useful to a wide range of users.

Audras’ Reusable Blocks Extended plugin, like many other amazing utilities for the editor, might be difficult to find unless you already know exactly what to search. Many times users are not even aware of the possibility of converting reusable blocks to patterns. This might also make a useful core feature but doesn’t seem likely to be a high priority at the moment. In the meantime, watch for more plugins to start extending block patterns to do interesting things now that they are available in core WordPress.

Collective #618



Collective 618 Item Image

Elder.js

Elder.js is an opinionated static site generator and web framework for Svelte built with SEO in mind.

Check it out



Collective 618 Item Image

Changing World, Changing Mozilla

Mozilla wants to become something “that excites people and shapes the agenda of the internet”. But sadly at the cost of letting go approximately 250 people from Firefox devtools, MDN, WebXR/Firefox Reality and more.

Read it










Collective 618 Item Image

Pixeltrue

SVG illustrations and Lottie animations, available for free for personal and commercial use (MIT License).

Check it out




Collective 618 Item Image

The Endless Doomscroller

Benjamin Grosser made an endless stream of doom, without all the specifics that can “… offer up an opportunity for mindfulness about how we’re spending our time online and about who most benefits from our late night scroll sessions”.

Check it out


Collective 618 Item Image

Previewed

Choose from ready-made templates to generate mockups, screenshots and video previews and for your app.

Check it out









The post Collective #618 appeared first on Codrops.

Stacked Cards with Sticky Positioning and a Dash of Sass

The other day, I spotted this particularly lovely bit from Corey Ginnivan’s website where a collection of cards stack on top of one another as you scroll.

I started wondering how much JavaScript this would involve and how you’d go about making it when I realized — ah! — this must be the work of position: sticky and a tiny amount of Sass. So, without diving into how Corey did this, I decided to take a crack at it myself.

First up, some default styles for the cards:

body {
  background: linear-gradient(#e8e8e8, #e0e0e0);
}

.wrapper {
  margin: 0 auto;
  max-width: 700px;
}

.card {
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 10px;
  box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.1);
  color: #333;
  padding: 40px;
}

Next, we need to make each card sticky to the top of the wrapper. We can do that like this:

.card {
  position: sticky;
  top: 10px;
  // other card styles
}

And that leaves us with this:

But how do we get each of these elements to look like a stack on top of one another? Well, we can use some fancy Sass magic to fix the position of each card. First we’ll loop over every card element and then change the value with each iteration:

@for $i from 1 through 8 {
  .card:nth-child(#{$i}n) {
    top: $i * 20px;
  }
}

Which results in this demo, which is totally charming, if I do say so myself:

And there we have it! We could make a few visual changes here to improve things. For example, the box-shadow and color of each card, just like Corey’s example. But I wanted to keep experimenting here. What if we switch the order of the cards and made them horizontal instead?

We already do that on this very website:

After experimenting for a little bit I changed the order of the cards with flexbox and made each item slide in from right to left:

.wrapper {
  display: flex;
  overflow-x: scroll;
}

.card {
  height: 60vh;
  min-width: 50vw;
  position: sticky;
  top: 5vh;
  left: 10vw;
}

But I also wanted to make each of the cards come in at different angles so I updated the Sass loop with the random function:

@for $i from 1 through 8 {
  .card:nth-child(#{$i}n) {
    left: $i * 20px;
    left: random(200) + $i * 1px;
    top: random(130) + $i * 1px;
    transform: rotate(random(3) - 2 * 1deg);
  }
}

That’s the bulk of the changes and that results in the following:

Pretty neat, eh? I love position: sticky; so much.


The post Stacked Cards with Sticky Positioning and a Dash of Sass appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

How to Fix WordPress Website Not Updating Right Away

Are you trying to fix your WordPress website not updating right away?

Often users ask us why some changes they make to their site like a new blog post, widget settings, don’t appear right away. It is a common issue and very easy to fix.

In this article, we’ll show you how to easily fix a WordPress website not updating right away.

Fixing a WordPress website not updating right away

Why My WordPress Site Not Updating Right Away?

The most common cause of a WordPress site not updating right away is caching.

By default, many WordPress hosting companies enable their own caching systems which store a temporary copy of your pages to improve website speed and reduce server load.

Apart from that, you may also be using a WordPress caching plugin on your own which may not be configured properly.

Last but not the least, your browser may also store a cached version of your pages in temporary storage.

Normally, when you make any change to your WordPress website those cached versions expire, and you get to see your changes right away.

However, sometimes due to some configuration error this may not happen right away. In that case you will see the old version of that page for a while.

The most common symptom of this problem is new posts not appearing on the homepage of your WordPress website.

While you can still view the single post by clicking on the view post link from the WordPress admin area, you are unable to see it on the main page.

That being said, let’s take a look at how to easily fix this issue.

Fixing WordPress Website Not Updating Issue

You’ll start by first clearing the browser cache. For most users, this should fix the issue, and you wouldn’t need to proceed to step 2.

Step 1. Force Browser to Reload or Clear Cache

Sometimes your browser (specially Google Chrome) will show you a cached copy of your website instead of showing the new one.

To resolve this issue, you need to simply hit CTRL + F5 (or Cmd + R in Mac) buttons on your keyboard to reload the page.

This will ask the browser to reload the page by fetching a fresh version. In most cases, this would fix the issue for many users.

However, if that doesn’t work, then the next step is to clear your browser cache. In Google Chrome, click on the three-dot menu in the top right corner. From the menu, you need to go to More Tools » Clear Browsing Data.

Clear browser cache

For more details, see our guide on how to clear cache in all major browsers.

Step 2. Clear WordPress Cache for Your Website

The second and most likely cause of this issue is poorly configured WordPress caching plugin. Most caching plugins make it super easy to clear your cache with the click of a button.

1. WP Rocket

If you are using WP Rocket on your website, then simply go to the Settings » WP Rocket page and click on the ‘Clear Cache’ button under the dashboard tab.

WP Rocket clear cache

2. WP Super Cache

If you are using the WP Super Cache plugin, then go to the Settings » WP Super Cache page and click on ‘Delete Cache’ button.

WP Super Cache delete cache

3. Bluehost

Even if you don’t have a WordPress caching plugin installed on your website, many WordPress hosting companies deploy their own caching system by default.

For instance, if you are on the Bluehost hosting platform, then you’ll notice a ‘Caching’ button in the admin toolbar.

Clear cache in Bluehost

Take your mouse over and you’ll see the option to ‘Purge All’ cache. This will delete all cached files from your website.

4. SiteGround

SiteGround is another top WordPress hosting company that offers its own built-in caching system.

You can manage SiteGround cache by installing and activating the SG Optimizer plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to click on the Purge SG Cache button in the WordPress admin toolbar.

Purge SiteGround cache

This will clear up SiteGround cache for your website.

For more hosting companies and caching plugins, see our complete guide on how to clear WordPress cache.

We hope this article helped you fix WordPress website not updating right away issue. You may also want check out our guide on the most common WordPress errors and how to fix them.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Fix WordPress Website Not Updating Right Away appeared first on WPBeginner.

Camera App with Transparent Overlay Feature

Hey Folks,

Hope you are all well. Long time no visit for me, but I had a weird question that I am struggling to answer and thought somebody here may be able to help.

I am looking for a camera app for my phone (either Android or iOS) that has the ability to show an existing picture with a degree of transparency when looking through the viewfinder [so to speak] at what the lens is currently seeing. In a nutshell, we have some pictures of our garden and having done a ton of work, I would like to do some before and after pictures. Ideally though I would like them to be as identical in terms of position and direction as possible. To me, the simplest way to achieve this would be to have a transparent existing picture to use to line up with when taking a new picture.

Whatever I search for though is not giving me what I am looking for. It is more than likely me that's the problem, but has anybody seen this or know of an app that can do it?

Thanks in advance!

Cheers,
Matrel

Python App with Modern UI

Good day y'all,

Im an intermediate Python dev and I've just finished building my first major Python project with UI. I tinkered a lot with tKinter (pun almost unintended) and even tried PyQT5. Both of these are time consuming to work with and tKinter's GUI looks like it shouldve been abandoned in 2005. Thats when my quest of finding an easy and modern looking UI Library started. And then I found Python Eel. Eel isnt a GUI Library like tKinter, but it can help link up python as backend with HTML/ CSS as the front. I didn't really know HTML and CSS a lot, but it was fairly easy. My project is at https://github.com/JeswinSunsi/PentyDesktopAssistant . It has a bit of Spaghetti code, but its pretty neat. I would appreciate it if you guys could check it out and give a review. Also, star it if you can ;)

Thankss.