Blogging using github pages
December 21, 2011
On holiday and finding that my blog was not available makes me think that
- self hosting on a broadband connection is probably not a good idea
- blogging on typo is not worth it
So I’m looking at simple solutions, using the ‘cloud’ and using my favourite tool (GIT)
One thing thats important to me is the ability to publish syntax highlighted code. For example here is a little ruby script I am using to create new posts.
#!/usr/bin/env ruby
unless ARGV[0]
puts 'Usage: newpost "the post title"'
exit(-1)
end
date_prefix = Time.now.strftime("%Y-%m-%d")
post_name = ARGV.join ' '
post_file_name = post_name.strip.downcase.gsub(/ /, '-')
posts_path = "/Users/andy/Sites/diabolo.github.com/_posts"
post = "#{posts_path}/#{date_prefix}-#{post_file_name}.markdown"
header = <<-END
---
layout: post
title: #{post_name}
---
Write the "#{post_name}" content here...
END
File.open(post, 'w') do |f|
f << header
end unless File.exists? post
Dir.chdir(posts_path)
system("#{ENV['EDITOR']} #{post}")
exit(0)
# vim: set filetype=ruby
And here is some cucumber stuff (gherkin)
Feature: Sign in
As a registered user
I want to sign in
So I can be recognised by the site
Scenario: Sign in
Given I am registered as 'Fred'
When I sign in
Then I should be signed in
Scenario: Sign in unregistered
When I sign in as 'Fred'
Then I should be signed out
Scenario: Sign in with bad password
Given I am registered as 'Fred'
When I sign in with a bad password
Then I should be signed out
Scenario: Sign in with bad email
Given I am registered as 'Fred'
When I sign in with a bad email
Then I should be signed out