Skip to content

Commit

Permalink
Add copy edits and CSS tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
rsese committed Jan 11, 2012
1 parent 6129627 commit 5caf783
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
22 changes: 10 additions & 12 deletions _posts/2011-11-25-reading-data-from-a-spreadsheet-with-roo.html
Expand Up @@ -35,18 +35,16 @@ <h3>Using Roo</h3>
# Iterate over the rows using the `first_row` and `last_row` methods. Skip
# the header row in the range.
((workbook.first_row + 1)..workbook.last_row).each do |row|

# Get the column data using the column heading.
age = workbook.row(row)[headers['What is your age in years?']]
gender = workbook.row(row)[headers['What is your gender?']]
most_identify_with = workbook.row(row)[headers['With which of these groups do you most identify?']]
global_region = workbook.row(row)[headers['In which global region are you located?']]
country = workbook.row(row)[headers['In which country are you located?']]
education = workbook.row(row)[headers['What is the highest level of education you have completed?']]
academics_helpfulness = workbook.row(row)[headers['How much have your academic studies helped you in your web work?']]

print "Row: #{age}, #{gender}, #{most_identify_with}, #{global_region}, #{country}, #{education}, #{academics_helpfulness}\n\n"

# Get the column data using the column heading.
age = workbook.row(row)[headers['What is your age in years?']]
gender = workbook.row(row)[headers['What is your gender?']]
most_identify_with = workbook.row(row)[headers['With which of these groups do you most identify?']]
global_region = workbook.row(row)[headers['In which global region are you located?']]
country = workbook.row(row)[headers['In which country are you located?']]
education = workbook.row(row)[headers['What is the highest level of education you have completed?']]
academics_helpfulness = workbook.row(row)[headers['How much have your academic studies helped you in your web work?']]

print "Row: #{age}, #{gender}, #{most_identify_with}, #{global_region}, #{country}, #{education}, #{academics_helpfulness}\n\n"
end</code></pre>
<p>We start by opening the spreadsheet and setting the default worksheet we want to work with using the <code>Excel.new</code> class method. Then the <code>sheets</code> property gives us access to all the worksheets in the spreadsheet in an array. The sample spreadsheet has only one worksheet, so we set the default worksheet to the first worksheet in the array using <code>sheets[0]</code>.</p>
<p>Next we create a hash of the column position and the header names to make it somewhat easier to work with the data. This hash will let us ask for data from the fields/columns in each row using the column headings from the first row. We can then iterate over all the rows in the spreadsheet using <code>first_row</code> and <code>last_row</code> methods. We iterate over the number of rows in the spreadsheet passing the row block variable to the <code>row</code> method, which returns an array of all the columns in the row. We use the <code>headings</code> hash we created earlier to access the columns by the heading name, and finally, we print the data to standard out.</p>
Expand Down
28 changes: 19 additions & 9 deletions _posts/2012-01-06-blogging-with-jekyll-quickstart.html
Expand Up @@ -87,7 +87,12 @@ <h3>Writing Your First Blog Post</h3>

<p>Now that we have the minimal layout done, we can create our two layouts; one for the blog post index, and one for our blog posts. Since we're mainly interested in Jekyll, we'll keep things simple. Our index layout looks like this:</p>

<pre><code>&lt;!DOCTYPE html&gt;
<pre><code>---
layout: default
title: Hello World Blog
---

&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
&lt;title&gt;Hello World Blog&lt;/title&gt;
Expand Down Expand Up @@ -116,16 +121,16 @@ <h3>Writing Your First Blog Post</h3>

<p>So if you want to have a slightly different layout for your posts (e.g. you want your blog posts to have a sidebar), you would change your <code>post.html</code> layout. And if you had a particular post that you wanted to layout differently than any other post, you can create another layout just for that post, and then you would connect the post to the layout in the YAML front matter. Just to add a tiny bit of variety to our layouts, we'll add a bit of HTML to our <code>post.html</code> layout, which adds a link back to the blog index page at the end of each post. Open <code>_layouts/post.html</code> and change the <code>&lt;div&gt;</code> with <code>id="content"</code> to look like this:</p>

<pre><code> .
<pre><code>.
.
.
&lt;div id=&quot;content&quot;&gt;
&lt;section id=&quot;main&quot; class=&quot;group&quot;&gt;
&#123;&#123; content&#125;&#125;
&lt;div&gt;
&lt;a href=&quot;/&quot;&gt;Back Home&lt;/a&gt;
&lt;/div&gt;
&lt;/section&gt;
&lt;section id=&quot;main&quot; class=&quot;group&quot;&gt;
&#123;&#123; content&#125;&#125;
&lt;div&gt;
&lt;a href=&quot;/&quot;&gt;Back Home&lt;/a&gt;
&lt;/div&gt;
&lt;/section&gt;
&lt;/div&gt;
.
.
Expand Down Expand Up @@ -164,7 +169,12 @@ <h4>Add Some CSS</h4>
<h4>Writing Our First Post</h4>
<p>We don't have any posts yet, so let's write one before we run Jekyll and check out our blog. Remember that you can write your posts in HTML, Markdown, and Textile; our first post is just going to say "Hello World", so we'll just stick with HTML. We'll date our post for January 1, 2012, so we'll name the file for our post <code>_posts/2012-01-01-hello-world.html</code>:</p>

<pre><code>&lt;h1&gt;Hello World!&lt;/h1&gt;
<pre><code>---
layout: post
title: Hello World
---

&lt;h1&gt;Hello World!&lt;/h1&gt;
&lt;p&gt;
Bacon ipsum dolor sit amet pastrami ribeye turducken short loin
biltong. Kielbasa t-bone ham hock short ribs, sausage ribeye prosciutto
Expand Down
3 changes: 2 additions & 1 deletion assets/css/master.css
Expand Up @@ -45,8 +45,9 @@ pre {

pre code {
display: block;
padding: 15px;
line-height: 1.75;
overflow: auto;
padding: 15px;
}

#container {
Expand Down

0 comments on commit 5caf783

Please sign in to comment.