Hacker News new | ask | show | jobs
by jedberg 4479 days ago
Static site generators are the new Fibonacci generator. When you learn a language it's a fun little exercise, and possibly even useful.

Also, everyone has slightly different requirements, so everyone likes to build their own.

I will most likely soon build my own static site generator, because none of the ones out there do exactly what I want. I will most likely borrow from at least a few of the examples out there and then post it on my github so there is yet another one.

I think we're seeing a proliferation simply because it is so easy to share code these days. Imagine how many Fibonacci generators would have been out there if it were as easy to share code when those were popular (I want to say 10 years ago but maybe it was longer).

3 comments

Had the same problem ourselves while building Segment.io that every static site generator was a bit too opinionated in weird ways, so we made Metalsmith[0]. Check it out, and you might not need to make your own anymore :)

[0]: http://www.metalsmith.io/

Ian how does it compare to gulp? Build tools with name-plugin-name are another proliferating area :).
> I will most likely soon build my own static site generator, because none of the ones out there do exactly what I want.

Why bother with the templating? Use Jinja2?

The templating is the easy part. It's all the parts that go around it that are the interesting/fun part.
The hard part is styling... I could even just upload a .txt file and be done with my blog.

    def fib(n):
        x  = ((1 + sqrt(5)) / 2) ** n
        x -= ((1 - sqrt(5)) / 2) ** n
        return x / sqrt(5)
Try n=1000 or n=10000.

    from math import sqrt
    from decimal import Decimal

    def fib(n):
        x  = Decimal((1 + sqrt(5)) / 2) ** n
        x -= Decimal((1 - sqrt(5)) / 2) ** n
        return x / Decimal(sqrt(5))

    print fib(1000)
    print fib(10000)
    print fib(1290309123)


  $ time python ~/fib.py
  4.346655768693891359691727380E+208
  3.364476487644307695949089018E+2089
  2.879417086171668653426018537E+269658658

  real	0m0.138s
  user	0m0.086s
  sys	0m0.026s