connection management with node.js
Strange thing. The wireless network I’m currently on seems to randomly disconnect. To prevent having to reconnect from the NetworkManager applet, I wrote the following simple script:
My First Normal Post on Jekyll
Steve Austin: Astronaut. A man barely alive. Gentlemen… we can rebuild him. We have the technology. We have the capability to make the world’s first bionic man. Steve Austin will be that man. Better than he was before. Better. Stronger. Faster.
My name is Rhoda Morgenstern. I was born in the Bronx, New York in December of 1941. I’ve always felt responsible for World War II. The first thing I remember liking that liked me back was food. I had a bad puberty; it lasted seventeen years. I’m a high school graduate. I went to art school. My entrance exam was on a book of matches. I decided to move out of the house when I was twenty-four. My mother still refers to this as the time I ran away from home. Eventually, I ran to Minneapolis, where it’s cold and I figured I’d keep better. Now I’m back in Manhattan. New York, this is your last chance!
Dr. David Banner: physician; scientist. Searching for a way to tap into the hidden strengths that all humans have… then an accidental overdose of gamma radiation alters his body chemistry. And now when David Banner grows angry or outraged, a startling metamorphosis occurs. The creature is driven by rage and pursued by an investigative reporter. The creature is wanted for a murder he didn’t commit. David Banner is believed to be dead, and he must let the world think that he is dead, until he can find a way to control the raging spirit that dwells within him.
run rspec test matching regex
I wanted to run just a test matching a specific pattern, from an integration suite. The SPEC_OPTS variable allowed me to do just that:
automating the commandline using ruby
Lately, I’ve been thinking about how to automate some commandline stuff. I knew about expect, so I started to dig into similar solutions for ruby. Turns out, there’s expect, but … it looks kind of complicated. And that’s how the search for gems with a nicer API started. I fire up github, and I write ruby expect in the searchbox. As expected, a ton of results, but some of them look promising. Until I see that there’ve been no commits in quite some time.
So, I order them by Recently Updated. And I stumble upon greenletters.
Seeing that it’s from Avdi Grimm, it kind of instantly gets a lot of credibility from me.
I read the introductory blog post, and I’m hooked.
So, I’ve decided to write a simple script, to automate running heroku run bash, because why not, right?
The first try failed really fast
Turns out, greenletters seems to have a pretty small timeout by default. After a bit of browsing around in the issues section, I stumble upon the :timeout option, which looks to be exactly what I need. After that, things just started to fall into place, so without further ado, I present to you the most useful script, which runs ls -l and cats the Gemfile:
Low and behold, it works. The run pattern is in that way, because when heroku runs a command, it’s output has the following format:
Also, the heroku shell command prompt looks like this ~ $. Hopefully, it makes sense why I used those regexes now.
I can see plenty of uses for such a gem, and it’s API is pretty nice to work with. Hopefully you can put it to great use. I’m interested to see what you’ll come up with :)
capybara login using warden helpers
Include Warden::Test::Helpers in your test, to be able to access the login_as method. Example:
jquery prevent enter from submitting
When trying to catch enter in a submit, the following did the trick:
sinatra routes inside a class
Working example of sinatra routes with routes inside a class: