Auto post to Pinterest from WordPress

Posted by & filed under Coding, WordPress.

A few months ago I needed a way to cross post from a WordPress blog to a Pinterest board. Yes, there are plugins that claim to do this. But the few free ones that I tried never actually posted, and I didn’t want to spend money on a paid plugin that might not work. So… Read more »

Seconds ago in JavaScript

Posted by & filed under Coding.

A couple of weeks ago I needed a way to convert a number of seconds to a more user friendly format for a project I’m working on. I’ve seen these called “ago” functions. They take a raw number of seconds and convert it to something friendly like “3 seconds ago” or “5 minutes ago.” Not… Read more »

Check if two String arrays are permutations

Posted by & filed under Coding.

Earlier this week I was working on a JUnit test for one of the AP free response questions from 2016 where you’re given an array of Strings and need to implement a class that randomly pulls one out using a getNext method. You’re basically writing an iterator without calling it that. But since it was… Read more »

Regex for Twitter username

Posted by & filed under Coding.

Working on a small weekend project I needed an easy way to validate that a string contained a valid Twitter username. Not necessarily an active account, but that could be an account. Found the rules on Twitter’s site that a username can be between 1 and 15 characters and can contain only the characters A-Z,… Read more »

NetBeans JavaScript not minifying

Posted by & filed under Coding.

Spent more time than I’d like to admin banging my head against my keyboard when NetBeans wouldn’t minify a specific JavaScript file. Instead of correctly minifying, the minified version would end up blank. Finally got frustrated enough to start tracking it down and found the cause in the line 2 pasted here. View the code… Read more »

Fading an image with PHP, GD, and Jaguar

Posted by & filed under Coding.

For a project that I’m working on I needed a way to fade out an image before overlaying text on to it. Text I’ve done. That’s not an issue. But I haven’t ever done anything with PHP with fading out an image. Turns out there’s a library called Jaguar that makes it, and other image… Read more »

How to remove .lead CSS class from parent theme

Posted by & filed under Coding, WordPress.

I’ve usd the 320press Bootstrap WordPress theme as a parent theme on a couple of projects, including this site. Overall, it’s great. But there’s been one little nagging “feature” that I’d like to get rid of. The theme adds a lead class to the first paragraph of each post. And the parent CSS for .lead… Read more »

Commit early, commit often

Posted by & filed under Coding.

Learned an important lesson today. I spent a good chunk of yesterday working on a new project. It’s a Moodle plugin that, when finished, will let you put code online for your students to work on along with tests so they know when they’re done and you can automatically get back a grade. But while… Read more »

One line PHP regex search

Posted by & filed under Coding.

Not sure this is the best way to do this, but it works. Working on a project and I’m writing a lot of code to do RegEx searches. Each match is 3 or 4 lines to do the match, check if there was a match, and then do something with the match. Since I was… Read more »