Notes and observations from coding: professional and spare-time

Quickly test a Rails routing table from IRB

:: ruby, ruby-on-rails

By: David

Here is a reminder of two quick ways to check your routes work, directly in IRB. Firstly, what path can you generate from your helpers?

1
2
3
4
irb(main):001:0> app.url_for [Client.last, :manage, Project.last]
  Client Load (2.0ms)  SELECT "clients".* FROM "clients" WHERE "clients"."deleted_at" IS NULL ORDER BY "clients"."id" DESC LIMIT $1  [["LIMIT", 1]]
  Project Load (2.0ms)  SELECT "media_stores".* FROM "media_stores" WHERE "media_stores"."type" = $1 AND "media_stores"."deleted_at" IS NULL ORDER BY "media_stores"."id" DESC LIMIT $2  [["type", "Project"], ["LIMIT", 1]]
=> "http://www.example.com/2-gelato-4-u/manage/projects/7"

Static sites with Racket

:: racket, lisp, site-generators, html

By: David

I saw from a recent Reddit thread that there are several static site generators in Racket. They vary in the markup language that can be used for pages, and the extent to which individual pages can have programmatically generated custom content.

Interesting options include

  • racket darwin (a fork of the dormant frog project; not related to ‘darwin’, Apple’s open source Mach kernel for operating systems)
  • pollen (that was written to make web books such as Practical Typography)
  • racket stories