Daily Twitter Digest

  • @TheCurrent: Oran "Juice" Jones! #
  • Just heard the courthouse skyway busker doing his morning warm-up exercises. Holy crap, that guy can shred! #
  • http://twitpic.com/17xbc6 – Yes! @TheCurrent played Oran "Juice" Jones! #
  • If you haven't heard the new Field Music album ("Measure"), you should. It's excellent! #
  • @ebertchicago I had no desire to see "Remember Me." Now after reading your review I want to, just to know what the refrigerator really is. in reply to ebertchicago #
  • Interesting dia-blog between @hotdogsladies and @marcoarment underway. I'm most interested in Marco's hosts file blocking of TechCrunch. #
  • http://twitpic.com/17yqwm – Target Field, March 2009 #
  • http://twitpic.com/17yr1m – Target Field, March 2010 #
  • Just walked by a public TV display broadcasting Glenn Beck. He was at a chalkboard diagramming the history of Marxism/Fascism… #
  • I love the melodic way Ann Taylor says "Dow Jones Industrial Average." #NPR #AllThingsConsidered #
  • Just saw a car with a Beware of Dog sign on it. Looked inside and there was a huge white dog sitting ramrod straight, staring right at me. #
  • Oh man, I missed 1/3 of Demitri Martin watching THE MARRIAGE REF?! I need a TV Guide. #
  • Walked by Target Field and around the Warehouse District today. It's amazing how much better this area is for baseball than the Dome. #

Sponsored Links

Daily Twitter Digest

  • Broken Bells = good stuff! #
  • I'm having a recurring dream where I'm Opie Taylor and I'm caught up in international intrigue with Jean-Ralphio from Parks and Recreation. #
  • @fraying Show me a smart comment thread, and I'll… well… I won't do anything, because it'll never happen. in reply to fraying #
  • Hmm… I never realized how much of Google Analytics is in Flash until I tried to look at it on my iPhone. #
  • Currently running a Slicehost feature I'd hoped never to have to use: restoring from backup. Wish me luck! #
  • On the subject of Slicehost: I did all of the server diagnostics and initiated the restore from my iPhone, lying in bed. #
  • The Slicehost backup restore seems to have gone off without a hitch. If you host with them, the extra $10/month for backups is worth it. #
  • I'm not especially into either Danger Mouse or The Shins, but I REALLY like the Broken Bells album. http://www.brokenbells.com/ #
  • Just downloaded new Broken Bells and Gorillaz albums. Yeah, I'm pretty hip. Except for the fact that I actually paid for them. #
  • How refreshing… I arrive at the end of the day feeling like I've gotten a lot done, instead of slipping even farther behind. #
  • Something I'll never understand: guys who flush the urinal BEFORE using it. #

Daily Twitter Digest

  • http://www.program-glitch-esc.net/ Guess I should finally see the original Tron. I always thought it starred Jeff Daniels, not Jeff Bridges! #
  • Kraftwerk's "The Man Machine" is probably still my favorite piece of electronic music ever. http://prog.room34.com/archives/437 #
  • Let's all hope Joe Nathan doesn't end up needing the Tommy John surgery. #MinnesotaTwins #
  • This American Idol contestant was EIGHT YEARS OLD when Kelly Clarkson won season one. Cripes. #
  • Now THAT's how you do a Fleetwood Mac cover. (Remembering the horrific version of "Dreams" from Hollywood Week.) #
  • Here's something you didn't know about me: I like Patsy Cline. And right now, I'm in visceral pain. #
  • Wow… I almost wish I had watched Glenn Beck to see this interview with Eric Massa. http://room34.com/s/150E6 #
  • Just tuned in… was that a "classic" Daily Show, or is there some reason they dredged up that clip of John Ashcroft's crooning? #

Daily Twitter Digest

Daily Twitter Digest

  • Politicians who call health care reform "political suicide" reveal their top priority is their own careers. #
  • Besides, last I heard, a majority of Americans still want reform, despite GOP/CPAC/Teabagger/Fox News spin. #
  • I just saw two strange cars on Portland Ave. in Bloomington… #
  • 1. A Velveeta-colored Audi TT. 2. A rusty, dented, early '80s Lincoln stretch limo. #
  • @stop I get that more than the "200 stuffed animals in the rear window of a car" thing. in reply to stop #
  • I can never buy a 24-pack of toilet paper without thinking of @JimGaffigan. #
  • Whenever something weird happens on the Oscars, I can never tell if it's a screw-up or a joke. #

Daily Twitter Digest

  • Sometimes you just have to let the kids go off into another room and beat up on each other. The hospital's not THAT far away. #
  • I'm joking of course. The hospital IS that far away. Wait… I mean… #
  • I'm pretty strong-willed where candy is concerned, but every spring I succumb to the annual bag of Reese's chocolate/peanut butter eggs. #
  • If you don't think sugar affects kids' behavior, can you come over and babysit tonight? #
  • I'm beginning to realize that it's the SOUNDTRACK MUSIC that made me like Metroid Prime better than its sequels (especially Corruption). #

Daily Twitter Digest

  • My children appear to be undergoing indoctrination into a Team Umizoomi army of some sort. #
  • http://twitpic.com/16rebn – I have work to do today, but this is right next to my desk. And it's calling my name. #
  • I hate spending 20 minutes trying to track down a bug that turns out to be bad data. #
  • Does Chrome REALLY auto-append a .xls extension on CSV downloads? If so… why??? (And If not, what am I doing wrong?) #
  • Even I, a loyal Apple fanatic, find Apple's "magical and revolutionary" just a TAD hyperbolic re: the iPad. (At least the "magical" part.) #
  • @johnyanarella Yes, I checked the same page in Firefox and it downloaded properly as a CSV. In Chrome, the file was identical but… in reply to johnyanarella #
  • @johnyanarella …an .xls extension was added to the filename (AFTER .csv, which was still there). The structure of the file was unchanged. in reply to johnyanarella #
  • @johnyanarella I don't WANT it to launch in Excel. Problem is Numbers can't tell it's CSV data when extension is .xls. in reply to johnyanarella #
  • @cm2 I'm wearing one now! in reply to cm2 #
  • The background paintings in Sleeping Beauty are amazing. #
  • @cm2 It's pretty great. It was my favorite shirt last summer and I'm glad it's getting warm enough for it again. in reply to cm2 #
  • @johnyanarella It's a site I'm working on. Pretty sure the headers are OK, but it's worth double-checking. Strange it only affects Chrome. in reply to johnyanarella #
  • @johnyanarella MIME type is text/csv. I wouldn't think Google would impose Excel on that. Guess I should Google it. in reply to johnyanarella #
  • As a self-appointed officer of the grammar police, I wholeheartedly endorse this comic: http://theoatmeal.com/comics/misspelling #
  • @johnyanarella It's generated by the server. in reply to johnyanarella #

Fun with CSS in WordPress

I just had an email exchange with an old friend and fellow web developer (and WordPress user) regarding some techniques for CSS trickery on home pages in WordPress themes. Up until this week, I had been running a version of my theme that just featured brief excerpts of articles on the home page. I was doing this by brute force in PHP, truncating the post text with the substr() function, and then cleaning things up using the strip_tags() function, which removes all HTML tags from a string.

It got the job done, but as he and I were discussing, it wasn’t pretty: it stripped out the “dangerous” stuff — that is, unclosed HTML tags (cut off during truncation) that would have screwed up the formatting of the rest of the page. But it also stripped out desirable styling (bold, italics, links) and paragraph breaks.

The ideal situation would be to have a way to show just the first two paragraphs of each post, retaining all of their original formatting. Of course, WordPress has a feature to handle this: if you put a <!--more--> comment tag in your post, your page template can truncate the post at that point, with a link to the single-post page to display the rest of the content. But I’ve never liked having to put that <!--more--> into my posts. I want a completely automated solution.

And then it hit me… this could be done with CSS. It took a little trial and error, but I came up with the following:

#content .entry p,
#content .entry h3
{
display: none;
}

#content .entry h2:first-child,
#content .entry h2:first-child + p,
#content .entry h2:first-child + p + p
{
display: block;
}

A few things to note:

  • This assumes that your entire loop is wrapped inside <div id="content">...</div>. You may need to come up with a specific ID to use just for this block in your index page, and be sure not to use that in your single-post page, or your posts will never appear in their entirety.
  • This also assumes that you’re using the WordPress convention of wrapping your posts in a pair of <div> tags with the attributes class="post" and class="entry" (though technically, class="entry" is the only one that matters here).
  • Your post title should be in an <h2> tag, immediately following <div class="entry">.
  • The first definition may need to be extended to include other HTML tags you want to hide on your index page. In this example, it’s only hiding content that is inside <p> or <h3> tags.
  • If you want to hide every HTML tag except the ones you explicitly specify, you could change the first block to #content .entry *, but keep in mind that will also remove styling like bold and italics, and it will remove links. Probably not what you want.

The specifics may vary depending upon how your WordPress theme is set up; I just know that with the way mine is set up, which pretty closely follows standard convention, this CSS worked to get the index page to list the posts and only show the first two paragraphs of each. (It also retained the images that I embed at the start of each post, and also retains any embedded video from YouTube or Vimeo, since — at least the way I insert them — those are not wrapped in <p> tags.

Note that all of the HTML content for each post is still loaded by the browser — we’re just using CSS to tell the browser not to show it on the page. This is not going to help with performance; it’s strictly aesthetic.

Daily Twitter Digest

  • It's easy enough to do directly once you know how, but this tool sure is slick. RT @daringfireball CSS Border Radius: http://?df.ws/epx #
  • I like the polish (if you'll pardon the pun) in Chrome: e.g. when sending, the spinner goes counter-clockwise and when receiving, clockwise. #
  • Is it just me or does Uncle Sam in that homebuyer tax credit commercial look like John Kerry? Also, why am I watching daytime TV? #
  • I just drove home from a meeting with the window rolled down. Ahh… spring is coming! #
  • @scenesfromahat I've heard that's a genetic thing. in reply to scenesfromahat #
  • Right now I feel like there's so much I don't know. http://knowyourmeme.com/memes/card-crusher #
  • @stevenf Wave's still a thing? in reply to stevenf #
  • Does anyone else own a copy of Can's Future Days (remastered) on CD? Does it work? #

“All in” is right

Today, according to banner ads and discussions from the likes of Neven Mrgan and Gizmodo, Microsoft is “all in.” All in “the Cloud,” that is, though the poker metaphor of betting the company on an all-or-nothing strategy seems apt.

Reading some of Steve Ballmer’s vacuous corporate speak surrounding this campaign (including the following PowerPoint-ready bullet points), I am not overwhelmed with enthusiasm for the endeavor:

- The cloud creates opportunities and responsibilities
- The cloud learns and helps you learn, decide and take action
- The cloud enhances your social and professional interactions
- The cloud wants smarter devices
- The cloud drives server advances that drive the cloud

My perspective on this kind of “communication” (such as it is) has evolved over time. When I was 25, it intimidated me, because I didn’t understand it. When I was 30, it annoyed me, because I realized there was nothing to understand, and it was just wasting my time. Now, at 35, it worries me, because I realize that this is how the people who are running things — important things like Microsoft, for crying out loud — actually think. They write nonsense like this and think it’s meaningful.

I wouldn’t bet on that.

Update: In Ballmer’s defense, the full presentation provided a lot more details than this bullet list, but it’s still a lot of not really very much.