middleman: passing local data variables between layout and template

Middleman is a great tool for creating static websites. Recently I've been using it to redesign my own website and a scenario I encountered was wanting to pass variables between my layout and my template file. Specifically, I wanted to pass information local data (a yaml file) to my layout file. Here's how I went about doing this: # in your layout file (inside layout/ folder): <% myvar = yield_content :myvar %> # in your template file (e.g., mypage.html.erb): <% content_for :myvar, data.somefile %> # this examples assumes there's a somefile.yml in your data/…Read more …

getting started with sinatra and postgres web service

I'm in the process of resurrecting some of my past projects. One of them is a web service that provided details for a given zip code. For example, you could lookup the zip code '15213' and the web service would spit out the geographical center for the zip code (i.e., the latitude and longitude coordinates), as well as the city and state for that zip. I originally programmed the web service using Ruby on Rails, but using RoR for a relatively simple API is a bit overkill. So I decided to use this project…Read more …

troubleshooting rvm install

In an effort to get reacquainted with Ruby on Rails, I embarked on installing rvm on my machine. Unfortunately, right out of the box, I ran into a few problems. Since I already have macports and the latest Xcode installed (along with its command lines tools), I started the installation process off by running : \curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled However, running that gave me this error message: curl: (60) SSL certificate problem: self signed certificate in certificate chain More details here: http://curl.haxx.se/docs/sslcerts.html I tried a bunch of options…Read more …