Rails in a week - day 3

              ·

TL;DR: phew. Deployment is hard. Testing is slow. Morning: off due to World Cup; watching of the match against New Zealand. :( Afternoon: while playing a bit more with the prototype, I noticed the logic is actually broken and my way to calculate an antipode was actually broken. This came from the fact that the longitude and latitude coordinates aren't logically the same. Latitude divides the globe on its equator while longitude is arbitrarily positioned… I guess?


Rails in a week - day 2

              ·

TL;DR: I have a terribly ugly first draft of the application working! Morning: spent finishing reading the Getting Started guide and beginning the Rails Tutorial. Afternoon: so, let's get down to maps… What's cool in Rails is that there are plenty of gems, and you just have to plug them in, right? GoogleMapsForRails seems like the right tool for the job. After trying to get my posts to be geolocalized… Success!


Rails in a week - day 1

              ·

TL;DR: I began learning Rails this morning, and even though Rails in itself is (seems?) easy enough, setting everything up and deploying is hairier. 8:00: let's get started! First step: getting vagrant up and running. We'll hit the tutorial. 8:15: the lucid32 “box”, Vagrant's parlance for a virtual machine image, is downloading. Time to get a cup of coffee. 8:40: box downloaded, let's get on with the VM setup process. vagrant ssh… Yep, it works!


Rails in a week - day 0

              ·

Tl;dr: I'm learning Rails in a week! And I'll blog about it all along. Any tips? So. Learning Rails. As a recent graduate in CS, moving to a new country in two weeks and looking forward to expand my skills, Rails looks like a good fit: it's in demand, it focuses on developer happiness, vibrant ecosystem yadda yadda. You probably already know this so let's cut the marketing speak! Methodology My main aim is to get familiar with the Rails ecosystem, but also to learn better processes in the way.


An interesting CSS hack for highlighting S-expressions

              ·

The Community-Scheme-Wiki has a pretty interesting way of highlighting lispy code Scheme being a Lisp dialect, it makes sense to highlight the S-expressions, i.e. “things between parenthesis”. The Community Scheme Wiki does exactly that. As you move your mouse over the code, it will highlight the s-expression you're in and the ones around in different colors, allowing you to quickly make sense of the code. An example can be found on this page, which renders like this as you move your mouse:


Deep sleep on MacBook Air Late 2010

        

Apple's latest MacBook Air boasts to last 30 days on battery when sleeping. Classical sleep will power down most of the machine (display, processor, hard drive, etc) but keep the RAM powered on in order to keep the state of the OS. However, the RAM drains too much power to realistically allow more than a week or so on a single charge. The MBA feat is achieved through “deep sleep”, i.


Semibold keyboard shortcut in Pages

             

So… Turns out there is no shortcut to turn text to semibold in Apple Pages, from the iWork suite. There are shortcuts for bold and italic respectively, but not semibold (or light / ultralight for that matter) even for the fonts that support it. The closest thing to a solution that I found is through Character Style: Select a piece of text, make it semibold In the Styles Drawer, under Character Styles, click on the little arrow next to “none” and “Create New Character Style From Selection” Assign a Hot Key to the newly created Character Style, by clicking the arrow next to it and Hot Key.


Automatically restart applications on OS X

              ·

I use GimmeSomeTune to provide hotkeys and some other goodies for iTunes. It works alright, but is veeeery crashy – usually every dozen hours or so on my machine. How to fix that? Let's relaunch it as soon as it crashes. Simple! In a terminal: for (( ; ; )); do open -W /Applications/Multimedia/GimmeSomeTune.app/; done open is the bash command to launch applications on OS X. It works with all kinds of files: open somefile.


nginx as a reverse-proxy to Apache+Sinatra

              · ·

I was recently developing a Sinatra app that wanted to host from home — setting it up Heroku would have meant migrating from SQLite to Postgres, and I'm lazy. The problem was that I already happened to have an Apache server at home to serve some other content, specifically some calendars through the WebDAV module. The solution I used was simple: instead of having Apache listening on port 80, I set up nginx to listen to port 80 and redirect to either Apache (set to listen on port 8080 instead) or Sinatra (port 9393) depending on the URL.


Large-scale, automated whimsy - A journey into blog spam

     

As you may have noticed if you write a blog, however modest it might be (such as yours truly), you'll receive spam comments. A lot. Things like that: Spam like this is usually obvious. Thankfully, some spammers go out of their ways to create engaging messages to fool your filters, both automated (like Akismet, who dutifully collected all the ones exposed in this post) and human. I've been collecting the best of breed (I know, I live a very sheltered life), such as…