Monitoring Harvest from CLI

Prompt

At WebDevStudios we use Harvest for tracking time.
The Harvest Time Tracker for Chrome is awesome.  Most of the time, I’m starting a new task from within Basecamp, or occasionally github so the chrome plugin is perfect.  I typically only go the harvest site to stop my tracker for lunch or at the end of a work day.

However, I often wonder about my hours for the week and if I can take a long lunch and catch an episode of X-Files.  But, I’m not neurotic enough to actually log into harvest and check.

So, I wrote a simple script that grabs my hours worked from the Harvest API and saves them to a file. I added this script to my cron to run every 15 minutes and then I include that file in my prompt:
prompt_segment white black $(tail /Users/garykovar/.tools/harveststatus)
(I’m using the agnoster theme in zsh).

Here’s what my prompt looks like:

PromptThe w is hours for the week and d is for the day…not real time obv…

And here’s the gist of it:

Edit:
Oh yeah…if you don’t edit your crontab and always have to google for syntax, here’s what I did:
*/15 * * * * /Users/garykovar/.tools/harvest

Five For the Future – Thanks WebDev Studios!

WCUS

I started working for Web Dev Studios about 90 days ago.
Shocker: I had imposter syndrome.
I’d never had a job as a full-time dev.
The last contract dev gig I had at an agency (with a super-smart owner and a PM I deeply respect) I was *fired* from for my inability to handle FED stuff.

One of the reasons I applied to WDS is the commitment to the WP community.  One day a month the entire company works on things to support OSS.  It’s scheduled.  It’s intentional.  It’s important.

This seems like it should be an easy, fun day.
I stress over my output these days.  I have 8 hours to do something that’s helpful to the WP community.

So far, for #5ftf I have focussed on our plugin-generator.  While the plugin gen does require some techie chops to install and generate with, the thing I enjoy most about it is strict pattern adherence.
It dictates a way of doing things.
It’s easily identifiable.
I use it every day, at work and on personal projects.
When I see a WDS plugin-gen project I know how it works immediately and can dig into very quickly.

On our company scrums on #5ftf days every single person talks about what they did for #5ftf.
It’s inspiring.
FED create things more usable and beautiful.
BED build and update plugins that are vital parts of many WP installs.

I can’t stop smiling during #5ftf scrums.

Look, the nature of a job is that sometimes…it’s not perfect.  Deadlines, stress, and personality conflicts.  These smart people I work with, when they get to dig in on #5ftf do amazing things.
It’s impossible to not root for them and be proud to work with them!

Too Soon for Nostalgia?

Friday, June 17th 2016 at 11:10PM my uncle died.  At least that was the time the nurse declared him dead.  If we’re splitting hairs I think he actually died at 11:09PM.  I almost said something to the nurse…but we were having this conversation at 11:13PM 3 feet from my uncle.  In that moment the minute didn’t seem to matter.

My uncle, Charles Wilk, was a smart-ass.  The good kind.  At the age of 22 he suffered a stroke after some blood-born something or other messed him up pretty badly.  He wasn’t supposed to walk again. I guess when you’re 22 sometimes you do know best.  While he never regained full use of the left side of his body he certainly walked, and more…

He was my Godfather.  In my family tradition that meant his role was to become my legal guardian if my parents died.  They didn’t, but he took that seriously (as did my Godmother for the record).  He was concerned about my education and he gave me the gift of curiosity.  A man of science, he was constantly reading and learning.  While he was unable to work due to his disability, he volunteered thousands of hours in his life to museums and libraries.

In the last year my family has lost my 4 year old nephew, my 88 year old grandmother and now my 65 year old Uncle.  Mourning sucks…and it sucks more to watch your family do it.

When my Mom and her siblings made the decision that it was time for hospice I went to the hospital.  Sometimes dying takes a while.  I knew we were probably in for a long day, maybe days.  I went home to say goodnight to my kids.  It occurred to me on the drive home that my Mom and Aunt would probably be taking the night shift.  I sent my mom a quick message offering to take the night shift.  I don’t know if I thought she’d say yes or if I thought she’d stay overnight.

In any case I arrived back at the hospital at 9:45PM.  I let my unresponsive Uncle know I was going to hang out until 5AM or so.  I pulled out my laptop, turned on some music and starting working on an upcoming presentation.  We listened to the Beatles, a favorite of mine and his.  Every few minutes I told him what song was coming up next and reviewed his vitals.  At 11:08PM the nurse came in.  She and I had not talked much.  She looked at his monitors and listened to his heart with a stethoscope.  I paused the music, closed my laptop and put my hand on his shoulder…and she looked across the bed at me and said “yeah…”  I thanked him and said a prayer.  It seemed like a lot longer than 2 minutes, or 1 minute or however long it was.

“He’s dead, I’m sorry for your loss.”  She stood there long enough…to make sure I wasn’t going to panic or do something weird I guess.  I walked to the foot of his bed and she left the room to get paperwork.  At that point I got lost in my thoughts a bit.  She walked me through all the info she needed from me.  I called my Mom and gave her the news.

And then I walked out of the hospital with a clear plastic bag containing his leg brace and clothes.

When I got home around midnight, I recounted some of the things that seemed important.  While we were talking of music Rhonda asked what song was playing.  I didn’t remember…but I popped open my laptop and looked at the paused song.  Blackbird.

I feel honored to have been there when he made the transition from living to dead.  I didn’t want him to be alone when he died. Neither did my mom.

I posted an entry about nostalgia almost a month ago.  I’m looking forward to getting back to that state of mind.

WordPress Best Practices

I spoke at the my local WPJax Meetup tonight.

The topic was Best Practices! (the ! is not optional)

This was my first attempt at a haiku for each slide.
I wish I’d had more time to prepare but I really enjoyed it.  It seemed like (based on questions) that it was at least somewhat useful to a few people.

And here are the slides: Best Practices

Nostalgia

RIP In Peace GG

I’ve written this post in my head a dozen times.  Some versions were really good. 

We’ve had a tough run lately.  I say we because so many family and friends have had to face death, loss, and crushing disappointments in the last 2 years.  In my younger years I did an excellent job avoiding funerals (including my own).  As of late, I’ve been to a few.  I even eulogized at one of them.  Funerals are one of those peak events in life…think of the person and you can immediately recall details of that raw hour of goodbye.

Enough of that…this is not a depressing post.  One of my favorite podcasts is Stuff You Should Know and recently they had an episode on nostalgia. In that episode they mentioned a John Hodgman quote “nostalgia is the most toxic impulse“. However, John clarified in a super meaningful way at the end of an episode about LSD.  I tell you all this so that you’ll get distracted chasing down Hodgman’s wonderful conversation about nostalgia and forget how you got there…

Still here? OK. I listened to the nostalgia discussion while literally and figuratively an hour into a nostalgia fueled mission to Tampa.  Years ago in another life Rhonda and I spent time with a dear friend recording and producing music. Since the arrival of our children we’ve stepped back from recording. However, my pal asked me to sit in and record one of his students. Not because she’s likely to be a professional musician (she’s just as likely to be a doctor or athlete or sales clerk) but because she’s talented and needed a challenge.

It’s been five years, three heart-breaking funerals, hundreds of failures, and a million thoughts of self doubt since I last recorded. How could one not desire the siren song of nostalgia?
I said this wasn’t a depressing post and it’s not.
It took about 90 minutes to get back into the groove of operating the board, figuring out how to describe the music ideas, giving encouragement when necessary, and insults to chase away the lazy.  Once things started “clicking” I felt it.  Just like old times…

A day of recording is exhausting.  By the end all senses, especially hearing, are a bit dull.  This warrants a much-needed escape…  For us that means BBQ, but it could easily involve mind-altering substances like alcohol or caffeine.

I’m not a pessimist.  I don’t find myself heavily invested in the bargaining stage of grief.  As we sat and gnawed on BBQ I recounted some of my disappointments and scars from the previous couple of years.  I was careful to frame it with the understanding that death is universal and outside of the last couple of years, I’ve been so fortunate.

When you’re used to winning, losing sucks…

Cutting to the heart of the matter my buddy (who has known me since high school) said: “When you’re used to winning, losing sucks.”

Damn.  So true.  It made sense.  Maybe I was chasing nostalgia…and when I found it I realized that I can be that good, lucky, smart and bold again…and better!  Experience colors all those previous memories and makes them that much better.

That curse of self-awareness is simultaneously the gift of opportunity and success.  Nostalgia, when used as an ephemeral tool, directs us to making microcosms of the world better.  That is a reason to be optimistic.

WP-CLI + Laravel Valet = Cool Tricks

Here are 2 ways I use WP-CLI and Laravel Valet

I do not consider myself a command line ninja.  In fact, I prefer to write my scripts as php files and kick them off with #!/usr/bin/php (still need to make them executable with chmod +x filename.php).

I am deeply in love with WP-CLI and Laravel Valet.  Both are command line tools. That means they can be intimidating with a HUGE list of commands that are mostly forgettable. But, I’ve found these 2 in particular have daily payoff for a small memory investment.

Backing up

One of my favorites.  I have a simple .php file executed by cron that looks at a directory and creates an array of directories inside. Then I exec(“wp db export /backuplocation/$dirname.sql”); which creates a simple backup file of the database.  In the same script, on the next line I run an exec(‘tar -cf /backuplocation/$dirname.tar *’);  One could put that .tar file anywhere…maybe even scp it somewhere?
Super double bonus for running this on a machine with dropbox/google drive/icloud and slapping your backup files in your folder-syncy-folder.
Oh! I forgot the best part.  After /backuplocation I have the day of the week.  So /backuplocation/$day/$dirname.sql would give me 7 rotating backups.  Obviously if you want to retain more you can run 30 days rotation or whatnot.

Local Dev

Installing Laravel Valet isn’t super easy, but it’s totally worth it. (plus if you aren’t on the homebrew bandwagon it’s time…)
I have a folder called ~/websites/ and in it are a bunch of odd-ball WP projects I’m working on.  Because I ran ‘valet park’ on that dir every directory I add in there resolves to $dirname.dev.

I have a php script in there that I run with:
./valetlocal.php newsite
It does the following:

  • Creates a new folder in ~/websites with that name.
  • Runs wp core download
  • Runs wp core config with the mysql settings I need (because I ‘brew install mariadb’)
  • Runs wp core install
  • Runs wp plugin install $newsite –activate

The wp plugin part fails most of the time but on occasion I’m spinning up a site to mess around with a plugin.  For those times I create a site with the plugin slug name and 25 seconds later I have a WP install with that plugin ready to go.  I could do the same for themes if I were to mess with them with some regularity.