All posts by Ben Kaplan

Headshot advice

Here’s some incredibly valuable headshot advice that you may not want to hear.

If you plan to have your headshot displayed on the web, do yourself a favor and make sure you offer up photos that are NOT trimmed right to your head.  Make sure your face is clear of the edge of the frame.

Sometimes people do funny things with your headshots, like put them in circles and your face will just get cut off and look dumb.

A nasty PHP hack

So, I’ve been dealing with a client’s hacked server for a few weeks now.  I thought I’d cleaned it up a few weeks ago, but stumbled across some ‘symptoms’ of this hack.  This lead me to dig a bit deeper, and I found this AMAZING write up of this particular attack by The Domestic Enthusiast.  The article is here.

This hack will work on any PHP framework.  So, if you are running up a straight up PHP site, Joomla, Drupal, or WordPress, check it out.  It’ll save you hours cleaning up a mess.

Mac OS X commandline goodness

Today I learned two things that’ll save be gobs of typing and manual manipulations.

  1. Preferences > Keyboard > Services  then check New Terminal at Folder
  2. sips

So say you are building out a site, and you are chopping up the graphics in photoshop or Illustrator, and you’ve got a nice tidy folder to scp up to your development server.  Well, you’ve been working in a given folder via your GUI and after you’ve set point #1 above, then you simply right click on that folder in the GUI and click ‘New  Terminal at Folder’, and wala, you are on the command line in that folder.

…no more CDing around.  You are just there 🙂

Ok, now suppose that you need to make all the images 25px smaller for whatever reason.  Forget Adobe Bridge, or forget creating that macro for Photoshop…just head back to the command line.

sips -Z pixelsize *.imagefileextension

…and your files are resized.  Be careful to work with copies of the originals.  There’s no going back on the command line 🙂

Custom Post Types and their single view

I’m often making custom post types for my clients.  I think a best practice for custom post types is to ensure there is a single view available so the end-user can view or preview the particular custom post type they are creating or editing.

I’ve encountered on many an occasion that when I go to view the custom post type, I get a 404 error.  I’ve spent many an hour noodling around, clearing the database and other fun means of forcing a round peg down a square hole.

I’ve never really figured it out…till today.  Thank you Google.

I’ve found that if I put this at the end of the function that registers the custom post type and it’s own taxonomy, that things work much better 🙂

flush_rewrite_rules( false );

It’s been a huge time saver for me. Hope that helps someone out there.

when ssh is not available

As a web developer, I often encounter clients who have a hosting package that is limited, or ‘secured’ by the hosting provider.  That means I sometimes am forced to use the dreaded FTP for file transfers rather than SCP.

This is ok when it’s just a few files here or there.  In fact, using the GUI can sometimes be convenient.  However, if I’m doing large scale development, I’d rather copy the site over to my development server rather than work locally and fill up my hard drive.

If the client’s hosting provider does not allow SSH access, then you can use FTP from the commandline 🙂

ftp ftp.example.com will get you there.  Then depending upon your flavor of linux, you can use MGET to pull files.  Sometimes you are even offered the awesomeness of RECURSIVE MGET *.

When you are not afforded that goodness, I’ve discovered that WGET does the trick even better 🙂

wget -r “ftp://user:[email protected]/somedirectory”

That’ll recursively get it all for you 🙂  Better yet…mirror

wget -m “ftp://user:[email protected]/somedirectory”

That initiates recursive and gives you infinite depths on directories…and…gives you the same timestamps as exists on the remote server.

Nice stuff.

 

The Benefits of webmail and another pitch for gmail or google apps

Today I discovered a great reason to utilize webmail rather than some local client like Outlook or Thunderbird.

You see, I recently switch all my emails over to Google Apps, and have been using Mailplane to access my emails.  Mailplane is pretty much a glorified desktop client that is really just an interface to gmail.  Essentially, when I turn on Mailplane, it’s as if I’m turning on Safari and logging into gmail.  All emails and attached files are sitting on Googles servers, and not on my computer.

When I switched over to Google Apps and Mailplane, I thought that was cool and all…until today.  Today, I realized how INCREDIBLY cool it is.

Today, I was digging around on my hard drive, wondering why the heck it was so full and trying to recapture some of that space.  I downloaded a nifty little application, Disk Inventory X, which shows you, visually, what’s actually on your hard drive.  Sounds silly, but when you are hunting around for what’s eating up your hard drive, and you don’t feel like hitting the command line and DFing everything, this little utility comes in handy.  Today it showed me some serious old file storage that did not need to be there.

As it happens, I was using Thunderbird as a mail client before.  It’s kept all my emails that were on google apps or gmail to the tune of 50G.  Seriously.  All that data is on Google’s servers AND my computer.  Now that I don’t use Thunderbird anymore, WHAM, 50G freed up!  Whoot!

Can you imagine what Outlook is doing to folks?

Another thing it showed me was how DropBox retains a copy of something if you unsynch it.  I’d unsynched about 8 gigs of data today, but it didn’t seem to be gone.  Then I found the Dropbox cache…8 Gigs.  WHAM, 8 Gigs freed up.

Sweet, now I’m about 60 Gigs lighter.  If only I could do that to my waist 😉

The command line

Ok, I’m a strange front-end developer, in that I learned how to develop on the command line, instead of dreamweaver.

Vim is my editor of choice, mostly because it was the first thing I learned and I’ve assembled my own library that works. Yeah, I learned Emacs when I took some of the CS 101 courses at Berkeley. It’s nice too. I’m not here for that particular epic debate.

My purpose today is to write down a quote. “The command line is like being there. Instead of visualizing the folders for you, you traverse them yourself.”

Using Font Icons

Ok, this topic has been covered quite well on the web, but I thought I’d do a little write up anyway.

We all use images for those groovy little icons.  For example, facebook buttons, ‘X’ for delete, etc…

Well, now that the use of embedded fonts is stable and more widely used, folks have started creating ‘icon’ fonts.  Chris Coyier created us a great demo page to prove why icon fonts are so cool.  He then goes on to write up a great list of available fonts.

Now that’s all more than cool, but what if the icon is the wrong direction?  Here’s what I’ve implemented 🙂


.flip {
-webkit-transform: scale(-1, 1);
-moz-transform: scale(-1, 1);
-ms-transform: scale(-1, 1);
transform: scale(-1, 1);
}

Snook has a great write up on rotating things.

.rotate {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
transform: rotate(-90deg);
}

Fun stuff!

Just a quick note about WordPress Optimization

I’ve been struggling with a clients site for a few weeks now that has an enormous lag on all page loads.  8 – 10 seconds…yeah, right?  Turns out the real issue is a conflict between the PHP and PHP cURL versions and…wait for it…I’m sure you’d never guess…a…plugin. I know you are stunned at that news.  That’s not why I’ve brought you here today.

I discovered that if you add a trailing slash ‘/’ after the URL to any given page in wordpress, you can avoid a 301 redirect.  For example, http://www.example.com/test-page, really gets redirecteed to http://www.example.com/test-page/.

Depending upon your server situation, you can save up to a second or two just by eliminating those redirects.

🙂