Synthesis : Scott Becker

Converting HTML to WordPress Themes

I continued to work on the minimal theme a bit last night after the post. I decided to experiment with web fonts, and found a serif font that is quite a bit nicer to my eyes than Times New Roman – Merriweather by Eben Sorkin. So the template now looks like this. I’ve got it to the point now where I’m happy with the way it looks. It looks good on mobile devices too.

Next up is converting this sucker to WordPress. I helped my girlfriend do the same thing a few months ago, but it’s been a while so I needed to dig up the resources again. I remember we used this tutorial last time, so I’m just using it again.

First thing to do was setup PHP on my local machine. I build most projects with Ruby or JavaScript, so I never really need to touch PHP. It comes with the version of Apache already installed on the Mac, but it wasn’t working quite right, and I have no time to mess around. I’m not here to fight with PHP all day, I have a theme to create. So I downloaded MAMP, followed the instructions for installing WordPress and I was up and running right away.

Next I exported all the content from my existing site. On the local version, I installed and ran the importer plugin, and bam, all of my content was loaded. WordPress is great in that so much of this infrastructure is already built. So far, this is easy.

Now it’s on to creating the theme “structure”. First step is about the structure of the main HTML file itself. Not much to do there. I already have an HTML file the way I want it. Moving to the next step, theme template and directory structure. I’m starting as minimal as possible, and the static template is already built, so I just have one HTML file, some CSS, and Twitter Bootstrap assets. I just copied index.html to index.php, and moved on from there tweaking it.

It’s nearly good enough to go live, but it still needs some tweaks. In the meantime, thanks to being hacked, I may just move to a static site generator. EDIT: It’s live!

Comments Off on Converting HTML to WordPress Themes

Minimalist Blog Template Update

Spent more time on the new blog template tonight. I’m basically going for the look of the Instapaper iPad app, but without all that Instapaper. Newest version is here.

The great thing about minimalism is it’s pretty easy to do. Just keep it simple. I added margins between paragraphs, headers and line height so the text can breathe a little. Converted the text to serif fonts, which is a departure for me. I’ll try it for a while.

The next step is converting it from static HTML to a WordPress template. I’m looking forward to getting this live.

3 Comments

Giving Tech Talks

So I’ve attended a few local tech meetups over the last couple weeks, and watched a handful of talks. Some of them are brilliant. Much respect to anyone who takes the time to prepare, practice, and get up in front of a group to talk about anything.

If you’ve never given a talk, and you’re watching one, you might not be cognizant of the speaker’s presentation style. At least beyond whether you’re paying attention, being entertained and enjoying it. You also become acutely aware if you’re bored and your brain has checked out and moved onto other things.

I’ve given a handful of tech talks. Once you’ve done this, and practiced your talk, you become much more aware of style, pacing, and flow, when watching others. I’m not as good as I’d like to be, but I’m at least aware of the gap between my taste and my work. Just like writing or music or anything else, the only way to get better at it is to do a LOT of it. Ten thousand hours. Go ahead, I’ll wait. In the meantime, I’ve taken some notes to myself on how to improve. This mostly applies to tech talks.

Do:

Use color on slides. Generic black and white slides are generic. Built in themes are boring. Don’t use them.

Use big text. I can’t read your tiny text and I don’t want to squint. Make it bigger.

Use less text. Make one point per slide. No extraneous stuff. Just the point.

Use non typical examples. In the web development world, typical examples are blogs and todo lists. Don’t use those. My brain and those around me will check out and think about beer and bikes instead. Use beer lists, bike map trackers, something, anything but blogs and todo lists.

Use the firehose. Be fast paced. Use complex terminology and reference deep math concepts. Or some other field of endeavor that we don’t already know about. Assume your audience is smart and keep up. We probably sped read your slides before you started speaking. Get to the point and be quick about it.

Don’t:

Explain individual lines in a vast sea of monochromatic code. Don’t throw up a full screen of black and white code and walk through what each line does. Show me a slide with only that line of code. In huge text. Syntax highlight the part you’re talking about.

Explain the history of the Internet. Unless that’s the main subject of your talk. Again, know your audience. And by now, everyone knows the history of the internet. Never speak of it again!

Explain the history and progression of Web apps. Same as above. Then AJAX came along. Yep. Move along.

Conclusion

Again, this is a note to me, not a knock on anyone else, as I’ve been guilty of these myself, and I’ve seen others make the same mistakes, and it’s hard to watch. But it’s also very easy to arm chair quarterback, so I’ll shut up. Speaking is hard!

2 Comments

Minimalist blog template progression

Ok, I put in a little more work into the new blog template tonight. If you’re just joining, in the last entry I declared my intention to create a new, basic minimalist blog template for this site and live blog it.

So, first I created an empty git repository and added a nearly blank readme file to it and threw it on Github.

Next is the question of how much HTML5-specific tags to use in the markup. I looked at the source of a few of the minimalist templates out there. The source on Mike Bostock’s blog is very HTML5. There is no head or body tags. Just the doctype, followed by a title tag, style and script tags, then right into content with HTML5 tags – header, aside, footer. Alex Payne’s blog has the more traditional head and body tags, various links and meta tags, etc. It doesn’t really seem to matter. Everyone got along fine before HTML5 tags. I guess they have more semantic meaning than plain divs with semantic classes. I found this handy HTML5 Element Flowchart, just in case you need help making these intense tag name decisions.

Then I went back to the Twitter Bootstrap framework, because I like it’s built in responsive design. I started with the appropriately named “starter template“, which still isn’t 100% minimal – it includes the ubiquitous top navigation bar that every lazy developer who uses Twitter Bootstrap fails to modify, so to start I just copied that file to index.html.

Next, since I’m building bootstrap from source (instructions), I compiled it with “make” and copied over the CSS and JS to an “assets” folder in my template project. Next was simply removing the top navigation bar, since I won’t be using that on the blog. Then to make it more blog like, I put in some long form generic lorem ipsum text and headers, and made it more HTML5-y by adding header, article and footer tags. It didn’t seem to make a difference to the look and feel, so why not.

-  <body>
-
-    <div class="container">
+  <body class="container">
 
+    <header>
       <h1>Primary Header</h1>
+    </header>
 
+    <article>

By default, this template resizes as you scale the window up and down, which looks good as it gets smaller, but isn’t very readable for a single column when the screen gets wide. With the chrome inspector pointed at the container element, you can see that depending on the width, different style rules start applying:

  @media (min-width: 1200px)
  @media (max-width: 979px) and (min-width: 768px)
  @media (max-width: 767px)

This is all coming from boostrap-responsive.css. Compiling from source actually turned out to be useful right away, because the LESS templates generate a lot of code for each of those layouts. You could remove them from the generated css file, but it would be a lot more code. With the LESS templates, you can comment out the wide layout in one line, and modify another and have it stop expanding beyond 768px wide:

diff --git a/less/responsive-768px-979px.less b/less/responsive-768px-979px.less
index 76f4f6d..7fa6dd0 100644
--- a/less/responsive-768px-979px.less
+++ b/less/responsive-768px-979px.less
 
-@media (min-width: 768px) and (max-width: 979px) {
+@media (min-width: 768px) {
 
diff --git a/less/responsive.less b/less/responsive.less
index 734b198..e8476ea 100644
--- a/less/responsive.less
+++ b/less/responsive.less
@@ -38,7 +38,7 @@
 @import "responsive-768px-979px.less";
 
 // Large desktops
-@import "responsive-1200px-min.less";
+// @import "responsive-1200px-min.less";

So far it looks like this. Yes, mind blowing. It’s a good start though.

Comments Off on Minimalist blog template progression

Creating a minimalist blog template

I’ve been meaning to create a new template for this blog. That’s probably not relavant for those of you who read this in a feed reader, it’s more for myself, because I actually look at this thing. I also like reading blogs on their actual sites as opposed to feed readers. I can’t be the only one. The current template is a built-in WordPress theme, and while it’s nice enough, it’s become totally generic and boring to my eyes. It’s also not-invented-here, and we can’t have that, now can we? Well we can, somewhat. I could go full static-blog-generator, use Github pages, or create a brand new blog engine, but WordPress works fine. It has lots of plugins that do everything under the sun. This is just about look and feel.

Another good reason for creating a new template – it’s always good to practice the basics. Like the idea of kata in martial arts, if you continually practice patterns of movement, they become engrained in muscle memory and you’re able to perform them flawlessly without thinking. Or so the theory goes. Master the basics.

Creating the template involves two basic steps: creating the static HTML, and then converting it into a wordpress theme by breaking it into multiple PHP files, adding tags for outputting posts, comments, etc.  For the next few blog entries, perhaps I’ll just live-blog the process.

So, first thing to do is decide what it’s going to look like. In the words of Edward Tufte and as mentioned here previously, “above all else, show the data.” In other words, it should be minimal. It should be easy to read. It should get out of the way. Something along the lines of Alex Payne and Mike Bostock‘s blogs, or Gist.io. A clean, uncluttered, single column of text. 13-14pt font size. Lots of white space.

Next, is deciding what, if any pre-existing tools to use to build it. The Twitter Bootstrap framework is nice because you can put together something decent-looking in a relatively short period of time. I’m not looking to reinvent the CSS framework wheel, so I’ll go with that. Only downside is including a lot of CSS I won’t be using, but that can be trimmed down. One bonus is the built in responsive-design support, so things look readable on mobile, and you don’t end up with microscopic text and need to zoom, which is what I’ve got going on now.

There’s a few ways to use Bootstrap. In the past when, I’ve just downloaded the current zip file and copied the precompiled CSS into my projects. That works and gets you up and running with something in a couple minutes. It’s also possible to customize it online and download the result. Or for ultimate flexibility, you can clone the full git repository, then customize and compile the CSS at the source level. I’m going to go the third route this time, because I’m just curious. Maybe I won’t need it. We’ll see tomorrow…

Comments Off on Creating a minimalist blog template

Gun Control

Gun Control is back in the collective mind after this week’s tragedy. A friend’s facebook post stating 100 round drum magazines shouldn’t be legal for citizens turned into a heated discussion with good points from both sides. As for my own personal opinion on this matter, I’m in favor of more regulation of semi-automatic assault-rifle style weapons. I do not think all guns should be outlawed or that the average person’s right to own a hunting rifle or a handgun in order to defend themselves should be taken away. Just that these more-efficient, high-round, long-range weapons ought to be harder to get. Perhaps only by oh, well regulated militias. Aka, trained military personel.

Here’s a link to Jason Alexander’s rant on the topic, expressed more clearly and at length.

Comments Off on Gun Control

Some Bloggers I Like

Leo Babauta of Zen Habits consistently has inspiring things to say, contrarian to the modern world of productivity focused culture we live in today. I feel more relaxed after reading his blog, and that’s reason enough to keep reading it.

Sacha Chua always writes interesting stuff, about starting her own business, learning new skills, and reviewing books with sketch notes.

James Altucher’s writing is like candy. The sentences are short. The titles get your attention. He’s not afraid to bleed. I read one of his ebooks. “How to Be The Luckiest Person Alive.” It was highly entertaining.

Ryan Bates started RailsCasts in 2007. RailsCasts isn’t really a blog. It’s a video tutorial site. Rails originally got popular in part because of short screencast demos. Ryan took this and ran with it, producing at least one new episode a week, teaching how to do some short focused thing in Rails. It started out all free. Now he has a pro-series and charges $9 a month for the more in depth episodes. I signed up immediately, because I already knew it would be quality stuff. I’ve watched many of them. But not all because Ryan produces them faster than I can watch them. I hope he’s making good money because he deserves it.

 

1 Comment

Being Our Best Selves

A friend of mine was thinking about the loss of his father recently. His father was a great guy who supported my friends and I during our teenagers-with-rock-star-dreams years. He shared a nice anecdote about him. “I will share that his last big proclamation about life was “don’t waste a minute”. We all have goals and plans, but it’s the actual journey that’s life. If you live each day living up to your own personal potential, especially in the way we impact others by being our best selves, no matter what the events of the day bring you can feel good about it.”

Comments Off on Being Our Best Selves

Context Trap

It’s a well known fact that context switching is expensive. It takes a while to ramp your mind into a different task when you’ve been working on another one. Work on project A, work some more, grind away. Now, switch to project B! Nope! Still thinking about A.

I don’t want to complain about the challenges of context switching. In fact I enjoy it, keeping lots of plates spinning at once. If I don’t, I tend to get bored. But therein lies the flaw! I need to make sure to avoid escape from”the busy trap” – doing a bunch of extra stuff voluntarily, because of a need to feel busy. I’m not talking about my one month blogging (and running) challenge that subsequently became a bet, probably for the best. That’s been good, and if anything has forced me to produce something on a daily basis, developing into a good habit, not to mention running 23 miles so far.

I’m enjoying that change and want to channel it into something else. My current monthly burn-rate is too high to go 100% on some non-immediate-income-producing idea, so that’s out. I have some savings but the thought of watching it dwindle while I spend all my time on something that doesn’t immediately generate cashflow is painful.

In August I’m going to suspend the blog-every-day challenge and re-dedicate that extra time to producing a product. Maybe another bet is in order? Working on what your used to is familiar and easy. Working on the important stuff is an exercise in self discipline. The next step is to simplify. And then keep things simple. That requires true discipline.

Comments Off on Context Trap

Learning D3 Part 7: Choropleth Maps

Update: I’m releasing a series of screencast tutorials on D3 at deveo.tv. Check it out and let me know what you think!

Choropleths are maps that indicate variations in data using different shades of color. Turns out you can easily build these using something like D3. How does that work?

// create a geo path - https://github.com/mbostock/d3/wiki/Geo-Paths
var path = d3.geo.path();
 
// create an svg element
var svg = d3.select("#chart")
  .append("svg");
 
// create a container for counties
var counties = svg.append("g")
    .attr("id", "counties")
    .attr("class", "Blues");
 
// create a container for states
var states = svg.append("g")
    .attr("id", "states");
 
// load the county shape data
d3.json("../data/us-counties.json", function(json) {
  // create paths for each county using the json data
  // and the geo path generator to draw the shapes
  counties.selectAll("path")
      .data(json.features)
    .enter().append("path")
      .attr("class", data ? quantize : null)
      .attr("d", path);
});
 
// load the state shape data
d3.json("../data/us-states.json", function(json) {
  // create paths for each state using the json data
  // and the geo path generator to draw the shapes
  states.selectAll("path")
      .data(json.features)
    .enter().append("path")
      .attr("d", path);
});
 
// load the unemployment by county data
d3.json("unemployment.json", function(json) {
  data = json;
 
  // for each county, set the css class using the quantize function
  // (an external CSS file contains the css classes for each color in the scheme)
  counties.selectAll("path")
      .attr("class", quantize);
});
 
// quantize function takes a data point and returns a number
// between 0 and 8, to indicate intensity, the prepends a 'q'
// and appends '-9'
function quantize(d) {
  return "q" + Math.min(8, ~~(data[d.id] * 9 / 12)) + "-9";
}

And the CSS classes for each shade of blue:

.Blues .q0-9{fill:rgb(247,251,255)}
.Blues .q1-9{fill:rgb(222,235,247)}
.Blues .q2-9{fill:rgb(198,219,239)}
.Blues .q3-9{fill:rgb(158,202,225)}
.Blues .q4-9{fill:rgb(107,174,214)}
.Blues .q5-9{fill:rgb(66,146,198)}
.Blues .q6-9{fill:rgb(33,113,181)}
.Blues .q7-9{fill:rgb(8,81,156)}
.Blues .q8-9{fill:rgb(8,48,107)}

Continue with the D3 Series:

4 Comments