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 »

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 »

Create a random string in JavaScript

Posted by & filed under Code Tips.

Found this one on Stack Overflow needing a quick and easy way to create somewhat random strings. If you visit the entire thread where this code was posted there’s a pretty good discussion of how to create random strings using math and date functions.

Automatically post to Pinterest

Posted by & filed under Code Tips.

This came about from needing a way to automatically post to a Pinterest board. Unlike most social sites, Pinterest doesn’t have a public API to handle auto posting so it took a bit of finagling and a Node.js package called Pin-It Node which does most of the heavy lifting. Once the script is in place,… Read more »

Toggle checkbox with jQuery

Posted by & filed under Code Tips.

Quick little snippet to toggle the value of a checkbox with jQuery. I needed this a couple days ago using a span with a font awesome image to take the place of a checkbox. Still needed an actual checkbox underneath for the form handler to work with. So I used this little piece of code… 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 »

How to post to Pinterest with node.js

Posted by & filed under Computers & Internet.

For another site I needed a way to automatically post to a Pinterest board. It’s a WordPress site, but I didn’t want the posting to be based on when a post went live. I needed a way to automatically post whatever the newest post was that hasn’t already been posted. I’ve already done something similar… Read more »

Datatables jQuery plugin – Refresh table

Posted by & filed under Programming.

Sometimes I try and make things way too hard. One of the things that a web app I’m working on needs is the ability to do an advanced search. It’s using the outstanding DataTables plugin for jQuery which takes care of most of the work. But the way I wanted to have the advanced search… Read more »