OK go look now

I moved RHNH on to a new host and it should be a lot more stable now. You should go have a look, because I just posted about a fancy new graph I made today.

Could whoever is managing the main byteclub page please switch my blog over to rhnh.net, since that’s where I’ll be posting from now on. Please leave this blog here for a bit though because I still have a heap of inbound links and I also need to finish moving some articles across.

Comments

RHNH2

Just launched the new and improved version of RHNH. I’m consolodating all my blogs there, so I’m going to stop posting here and then redirect to it once I’ve migrated all my posts across. A task I’m not really looking forward to.

EDIT: It’s being a bit temperemental … doesn’t seem to restart properly when I redeploy. I really need to get it running through mongrel. Or get some proper hosting.

Comments (1)

Light-weight web development with Erubis

I doing up a small web page containing only static files. But I still wanted the power of ruby for certain bits of generation and templating. If that sounds up your alley, gem install erubis and follow along…

First, a custom erubis builder to load up our environment so we can use our own class objects in the context. If you like you can just pass a yml file straight into erubis using the -f flag, but I wanted to do some processing of the data first, so:

require ‘erubis’
require ‘yaml’
 
require ‘lib/my_object’
 
# Load context
objects = YAML.load(File.open(‘data.yml))
 
context = {
  :my_objects => objects
}
 
ARGV.each do |arg|
  input = File.read(arg)
  eruby = Erubis::Eruby.new(input)
  puts eruby.evaluate(context)
end

A Rantfile:

import “autoclean”
 
gen Rule, /^build/[^.]+.(html|css)$/ => lambda { |t| [“#{t.gsub(’build/’, ’src/’)}.erb”]} do |t|
  sys “ruby lib/erubis.rb #{t.source} > #{t.name}”
end
 
file “build/images” do |t|
    sys “cp -R images build/”
end
 
task :build => %w(index.html main.css images).collect {|x| “build/#{x}”}
 
gen AutoClean, :clean

Then you can use FileSystemWatcher to automatically kick off your build when any source files change:

require “filesystemwatcher”
 
watcher = FileSystemWatcher.new()
watcher.addDirectory(“src”, “*.*”)
watcher.sleepTime = 1
watcher.start { |status,file|
  print “#{file} changed, rebuilding…”
  `rant build`
}
 
watcher.join()

Voila! Now you can even keep your static projects DRY. Sure beats copy and paste coding.

Comments

This is stupid: Hash#select vs reject

Comments (2)

Convert M4A to WAV in Ubuntu

Comments

Go

Comments (1)

The Switch to Vim

Comments

Who wants some work?

Web stuff, basically cutting up a photoshop comp into a website. Already sample HTML (it’s a clone of another site), plus CMSing the thing. If you want to quote on it send me an email for more details.

I just don’t have the time to do it myself :( Too much dancing…

Comments

Practical Hpricot: SVG

Comments

SwinBrain article suggestion

Comments

« Previous entries ·