Welcome to SeanBuscay.com

I provide services for and write a blog about:

I am a Senior Engineer and Technical Lead with over 15 years experience.

Learn more about what I do.

Seven Life Lessons I Learned Growing Up Surfing

I grew up on Central California’s Pacific coast, along the Monterey Bay. It’s an awesome place to grow up if you love the ocean, and I do.

From an early age I remember body surfing at the Asilomar with my older cousin. In those endless days, happily bobbing in the frigid Pacific waters among the sea weed and the sea lions, I learned to make the most out of every wave my beach sent me.

As I think back now, I realize those waves and that beach also taught me a good deal about making the most out of everything life sends me.

Here’s seven life lessons I learned growing up body surfing:

  1. If you miss a wave, don’t worry, another will be along soon enough.

  2. Sometimes you have to miss a good wave if you want to catch an even better one on the horizon.

  3. It takes real work to get into position to catch the right wave and ride it to the end.

  4. Some waves will thrash you pretty bad, but they are usually the most fun.

  5. If you get swept out by the tide, remain calm, change direction slightly (parallel to the beach), and swim back to where you were last in good water.

  6. It’s better to surf with a partner than alone.

  7. Never miss a sunset if you can help it.

How I Added Teaser and Read-more Functionality to My Jekyll Blog on GitHub Pages

For my Jekyll blog, I want to give readers a typical river of news1 list of post titles with teasers. I also want readers to be able to paginate through past posts, via a series of pages listing ten posts per page.

When readers click on a “Read more” link in a post teaser, I’d like them to go to the full post text, starting from the last point they read, which is typically not at the top of the post.

Here’s how I used Jekyll’s template system to get exactly the feature-set I want.

Pagination

Jekyll provides detailed documentation for how to paginate posts .

For my pagination feature I add these variables and values to my Jekyll _config.yml file.

paginate: 10
paginate_path: "blog/page:num"

The paginate variable set to 10 tells Jekyll to list ten posts per page.

The paginate_path tells Jekyll what URL structure to use when generating each page in the paginated series.

The settings above tells Jekyll to create URLs like: /blog/page2/, /blog/page3/, etc.

You can change these patterns to fit your own blog structure.

For example, the value posts/page-:num would generate a URL pattern like, /posts/page-2/.

Page one of my blog is my homepage, so I must tell Jekyll to render the first page in its pagination series differently from the other pages. Jekyll provides snippets to render paginated posts. In my case I needed to use the second code snippet on the page which handles the “page one edge-case.”

Teasers (AKA Excerpts)

Jekyll’s default post excerpts behavior is to use the first paragraph of a post as the post’s excerpt/teaser. It does this by grabbing the first block of text from the beginning of the post to the first excerpt_seperator it finds.

The excerpt_seperator is a Jekyll variable which may be set in the _config.yml file.

By default its value is:

excerpt_separator: "\n\n"

For my teaser feature I set the value to:

excerpt_separator: <!–break–>

The separator value could be almost anything. In order to change it from using the first line break, I chose to use the same separator as Drupal2. (Helpful because I migrated my content from Drupal.)

The change gives me two advantages right away:

  1. I control exactly where my excerpt breaks in my post (using an html comment which is not rendered directly to the reader)
  2. I can create short status-like posts which use the full post content in the post listings (by not adding the <!–break–> to the post body)

If I need anything beyond the two options above, I can always override automatic excerpts by adding excerpt to my post’s YAML Front Matter like so:

title: "How I Added Teaser and Read-more Functionality to My Jekyll Blog on GitHub Pages"
excerpt:
         <h3>Add a Custom Excerpt to Your Post</h3>
         <p>Find out how!</p>
  1. a long list of all the posts, sorted by time.

  2. You could always use the Wordpress <!--more-->as described in this post

Read more

How I Add a Table of Contents to my Jekyll Blog Written in Markdown

For my Jekyll blog I want to add a table of contents to some of my larger posts so readers have an overview of the post content and may click links to jump to sections which interest them most. I’d like Jekyll to automatically generate the markup for the table of contents based off the headers in the post.

Here’s how I set up Jekyll to get my table of contents (toc) feature.

Configuration

By default, Jekyll on Github pages is configured to use Kramdown to parse and convert Markdown1 to html format for blog post pages. Jekyll’s markdown conversion option is set in the _config.yml file like this:

markdown: kramdown

Kramdown, in turn, is set by default to support the automatic generation of header IDs during conversion.

Kramdown (also by default) supports the automatic generation of the table of contents of all headers that have an ID set.

When the auto_ids option is set, all headers will appear in the table of contents as they all will have an ID. Assign the class name “no_toc” to a header to exclude it from the table of contents.

My action step to configure Jekyll to get my table of contents feature was to change nothing. :)

Implementation

Implementing the auto table of contents feature is almost as easy as the necessary configuration.

Here are the steps to add the toc:

  1. Add an ordered or unordered list to the content body at the point you want the table of contents to appear
  2. Add the following snippet immediately below the list: {:toc}2
  3. Jekyll (using Kramdown as its converter) will replace the list with a toc automatically generated from the headings in the content

Here’s the markup I use to add tocs to my posts:

* TOC
{:toc}

The number of items in the list and the content of the items do not matter, because they will be replaced by the toc when the content is parsed.

Close

Here’s a post which uses the table of contents feature: http://www.seanbuscay.com/drupal-web-development/what-web-developer-learned-stage-director/

I’m happy to have found this useful auto table of contents built right into Jekyll. If you have a Jekyll blog, I recommend trying it out if you haven’t already.


  1. http://en.m.wikipedia.org/wiki/Markdown

  2. The snippet is an Inline Attribute List (IAL), which is an element used by Kramdown to attach attributes to other elements.

Why Test Software?

As Drupal developers and users we share our software with a community of 630,000+ other users and developers (http://drupal.org/about). We have entered into a great social contract. We trust each other that our core and contributed code will work as they are supposed to. With the scale of the community and the scale of the code base there will be some exception. The introduction of a testing framework into Drupal has significantly helped reduce those exceptions and provide the community and clients with confidence in the quality of Drupal.

Drupal 7 has seen major benefits from embracing the testing framework. [Testing] has significantly enhanced the way core is developed and made it possible to make major API enhancements with confidence.

– http://drupal.org/simpletest

Software testing in Drupal benefits developers, client stakeholders, and end-users. This short series of posts is written for these audiences. In this series we will do some basic exploration together into the why, what, and how of software testing as it relates to Drupal web development. Throughout the series the reader will find links to resources for further review. This first post in the series examines the question of, “Why test software?”

Read more

Git Flow and GitHub Flow

The following is the git workflow model I recommend for non GitHub users:

http://nvie.com/posts/a-successful-git-branching-model/

For GitHub users, I recommend: GitHub Flow

  • If you are not a power user of git yet, I recommend the free online Git Pro Book particularly chapters 2, 3, &5.

Just re-discovered the power of wildcards with Drush

Enable all your project specific features and modules at once, Revert project features

drush en -y projectname_*
drush fr -y projectname_*
drush updb

List and get the status of just your project features

drush fl projectname_*

Revert just your project’s content types

drush fr -y projectname_contentype_*

Drupal Features Helpful Links

Bundling site settings using Features: http://drupal.org/node/580026 - (all materiel in this section)

Building and deploying sites using features (PDF) : http://capitalcamp.org/sites/default/files/slides/CapitalCamp%20Features.pdf

Managing and deploying configuration with exportables and the features module (Video): http://sf2010.drupal.org/conference/sessions/managing-and-deploying-configuration-exportables-and-features-module.html

Drupal Pattern: When to use different content types

As a general rule of thumb, any content which requires one of the following, is a candidate for its own content type:

  • discrete fields, not used often or at all in other pieces of content
  • business logic unique to the piece of content ( access requirements, section placement, workflow)
  • major layout or page structure differences in the presentation layer
  • different uses or discrete conceptual differences ( a blog page and a page content type may be excactly the same, be tagged the same, but require content contributors to think of them and their uses differently)
  • list separation requirements such as: a block of just Company news and a block of just department News

Now there are always exceptions and other ways to meet the same functional requirements. The last item above, for example, would likely be best met via taxonomy. Others functionality may be developed using context. 

Sources for Drupal Screen-casts and Learning

All Chicago Drupalcon Videos: http://blip.tv/drupalcon

Drupalcon Videos 2007 to 2010: http://archive.org/search.php?query=drupalcon

D.org Videos List: http://drupal.org/videocasts

Drupalizeme: Still free stuff: http://drupalize.me/

Modules Unraveled: http://modulesunraveled.com/

Mustard Seed: http://mustardseedmedia.com/podcast

Each Drupal Con Site, browse by Session:

OWL Window Logger -An active window logger. Built in Python. Logs to JSON.

I just released a new development project github to help people who work mostly on computers better track what they spent their day working on.

Check it out: https://github.com/seanbuscay/owlwindowlogger

OWL is an active window logger to help track time spent working in different computer applications and windows.

Log files are written to JSON to be consumable via many systems. Logging may be extended to write to CSV files or other formats.

OWL tracks and logs your computer system’s:

  1. Active window titles
  2. Start and stop times when windows become active and stop being active
  3. Idle time
  4. Application thread names for active windows
  5. Other variables through easy module extension