DRUG #25
During my leave in beautiful Wrocław, I had a chance to attend DRUG #25 meet-up. DRUG (Dolnośląska Grupa Użytkowników Ruby) is Lower Silesian Ruby user group, and their meetings usually take place once a month.
Andrzej Krzywda introduced me to a non-written rule of DRUG, which states “[i]f it’s your first time then you are presenting a talk”. I presented a quick talk about Travis CI. While it came as no surprise, that everybody knew the topic, it was especially nice to see people asking more detailed questions about current state, the future and sharing what they have done with Travis.
The people I met are tremendous and I will be happy to see them again on Wroclove.rb! Big thanks to all attending and especially to @kolarzowski, @piterniel for having me at their office during my leave. See you all soon!
Git autocomplete in bash on a Mac
I’ve been using Linux and bash for great chunk of time for web development, and it always had great features like autocomplete, that I didn’t get by default on a Mac.
So, I’ve decided to take matters into my on hands, and leave a post for all those, who are also bugged by no git autocomplete in bash on a Mac.
Thankfully, git already has its autocomplete script, so it’s a matter of just two commands:
But I like to take it one step beyond. To save some keystrokes, I’ve added some aliases to my ~/.gitconfig:
Now I can tab on git co
“Birthday” gem for easy anniversaries handling
While working on one of our client projects, I was asked to create a search for users’ birthdays. Instantly, I remembered what problems I had with it in the past, like taking care of not only finding the right dates by only day and month, but also, checking for birthdays today, any upcoming birthdays, or even just looking up user’s age based on that information.
So, to never ever repeat that code again (and to keep the code DRY), I’ve decided to write a simple gem specifically for this stuff. And thus the birthday gem was born.
Requirements
The gem has been tested against Rails 3 (3.0.9) and Rails 2 (2.3.14), and depends on ActiveRecord and ActiveSupport (for inflections), making it a perfect fit for Rails. It is possible to use it outside Rails project, but you are required to use ActiveRecord as your ORM framework.
The gem works with MySQL and PostgreSQL adapters, but you can write your own adapters, if you need to. If you do so, it would be good to fork the gem and add it there for everybody to use. :)
So, how does it actually work?
Handling birthdays wasn’t that easy before. Here’s what you have to do in your model:
That’s all. This one line enables extra actions on the “birthday” field (of DATE or DATETIME types) in your database. For example from now on you can search for birthdays
- on a specific date:
- between a specific range:
- and even at the turn of the years:
All these methods are essentially scopes, so you could also do something like:
On top of that, you get convenience methods for single records, like getting the age:
You can get any field to behave like this. For example, let’s say we want marriage anniversaries:
And it’s done, from now on you have convenient scopes to search and handle anniversaries:
Final words
I’ve done this gem, because I never ever want to write this piece of code again, I’d rather spend my time on actually coding the important stuff in applications, than to fiddle around with dates and birthdays. Hope this gem will be of some use to you. If not, fork it, and patch it to your needs! :)
10th anniversary of Polish Wikipedia
Last weekend, as a long-standing Polish Wikipedian, I went to Poznań to celebrate the 10th anniversary of Polish Wikipedia.
The event started on Friday, September 23th and went on until Monday, September 26th, the actual date of establishing Polish Wikipedia. During that time, I’ve met old friends, colleagues, and newcomers to our project. The event took place in Multikino cinema in Shopping, Arts and Business Center “Stary Browar” (lit. “Old Brewery”), a place dating back to 1844, when Ambrosius Hugger, a Wirtembergian brewer, came to Poznań to start his brewery there.
Author: Radomil. License: CC-BY-SA
Almost 200 people came to celebrate with us and to participate in talks and presentations, making it the biggest Wikipedia meet-up in Poland so far. As usual, there were also guests from other countries: we were visited by Wikipedians from Germany, Czech, Belarus, Philippines, Hungary, Ukraine and Russia. On Friday we spent time on getting together, drinking beer and organizing our stay in hostels.
The actual event started on Saturday with a discussion between founders of Polish Wikipedia, Paweł Jochym and Krzysztof Jasiutowicz, who told us about the beginnings of Polish Wikipedia and how they imagine its future. What’s worth noting this is also the first time these founders actually met each other. Before now they only collaborated on the encyclopedia online, and we’ve never seen them together during one conference. Other speakers included: Jan Wróbel (a contributor to a weekly newsmagazine Wprost), Piotr Marcinkowski (vicepresident of Library of University of Poznań), Sylwia Ufnalska (translator and science journalist), Jarosław Lipszyc (president of Modern Poland Foundation) and Edwin Bendyk (famous editor, blogger and journalist).
We also had a chance to see a documentary Truth in Numbers? Everything, According to Wikipedia, which explores the history and cultural implications of the online user-editable encyclopedia Wikipedia. The film attempts to answer the question of whether all kinds of individuals or just experts should be tasked with editing an encyclopedia.
Apart from that, there was a surprise made by Wikimedia Polska Association for all editors: a video with congratulations on the anniversary from famous Polish people:
Congratulations for our work were given from: Polish president Bronisław Komorowski, professor Jerzy Bralczyk, Bartłomiej Chaciński, Ilona Łepkowska, Marek Niedźwiecki, Krzysztof Skowroński, Mariusz Szczygieł and Ewa Wachowicz. President Komorowski encouraged to edit Wikipedia and share the knowledge, Mariusz Szczygieł and Marek Niedźwiecki admitted Wikipedia helps them in their work, and professor Bralczyk expressed his pride in Polish Wikipedia being one of the biggest language version of this encyclopedia.
Author: Polimerek. License: CC-BY-SA 3.0
And thus, the event concluded on Sunday, with a group photo of all the attendees, after which all of us started going home, tired, but happy after seeing each other again, hoping we can make the best of this great project, to which we contributed over past decade. And that is what I wish to Polish Wikipedia for this and next decades to come! Let’s make the best encyclopedia ever!
Photos from the event are available on various free licenses on Wikimedia Commons in [[Category:10th birthday of Polish Wikipedia]]
Railcamp Poland after some time
In April, we, in cooperation with few Rails community companies, have organized the first edition of Railscamp Poland. Railscamp Poland took place in Wisła, the same Wisła where Adam Małysz, a legendary former ski jumper, is from. We are very happy how the event turned out, and that many people spoke well about the organization of it.
So, right now, when I look back at the event, what do I see?
I see happy people, getting together, in one case, to have a good time while doing what they like! And all the time we did just that. There was a bit of coding, but mostly we had fun playing Guitar Hero, singing, playing Urban Terror.
Some quick (and not entirely accurate) facts about Railscamp Poland:
During the event, people:
- drank 20 liters of vodka,
- drank 40 liters of Club Mate,
- eaten 50 kilograms of pizzas,
- eaten 120 sausages,
- got 250 euro from a deposit for returned beer bottles,
- wrote daily 4000 lines of code (including 2600 while drinking), which test coverage is at 100%
Again, big thanks to these guys for making this possible:
The photos from the event are available on Flickr and Ipernity.





