Javascript Loop

Day Two – Loops

Took a look at the for and for / in loops and how they’re used in variables and objects to pull information.

var warGoodForObject = {
"what": "nothing",
"who": "no one"
};
for( var name in warGoodForObject ) {
console.log ( name + ": " + warGoodForObject[name] );
}

Results in console:
what: nothing
who: no one

100 Days of Javascript

Javascript For Web Designers by Mat Marquis

Starting today I’m taking on the challenge to re-learn javascript. The last ten years have led to countless updates, APIs and new frameworks that I’ve largely ignored in favor of focusing on HTML, CSS and enough PHP to get the job done in WordPress.

Day One: Relearning the basics

Javacript for Web Designers by Mat Marquis

Specifically chapter three which focuses on conditional statements such as if, else and else if. True and false and math.

I expect the first 30 days will find me reading about the DOM and running tests in my browser’s console before the actual fun begins.

Break stuff, but don’t forget to have backups

Hole
Pixabay

I’m one of those WordPress guys who rant about keeping regular backups. Even using a fantastic plug-in that automatically runs a backup every weekend. Everything was running great and I had months of backups safely stored on my web server.

Until today, I decided try and install Certbot without testing it on a non-production server first.

Everything seemed to work perfectly. Until I rebooted my server droplet and it was serving up my index.php template as straight code. Certbot and My Digital Ocean WordPress droplet had a conflict, likely I made a mistake.

As best as I could tell Certbot expected Apache to be configured a particular way; perhaps it the droplet’s customizations were at odds. Either way I no longer had access to my droplet via ssh, sshfs, or ftp to download my server side backups. To make things worse I didn’t store any backups locally or on another server.

This could have been easily avoided

  1. Digital Ocean offers snapshots and backups that can be manually deployed at any time. I didn’t bother to create one.
  2. I had months of weekly backups. I didn’t bother to take a few minutes to download one.
  3. My backup plug-in, online communities and my own rants about keeping multiple backups were not heeded.

It’s not all bad – This blog is where I test ideas and break stuff

Of all the posts only three or four contained useful content. The rest was old posts imported from social media and a few bits of custom wallpaper. Nothing was irreplaceable or important.

Feel free to break stuff in production, just don’t forget the backups.

WordPress Codex Resources: