Menu
abriraqui
  • reflexiones
  • publicaciones
  • hackership
  • experiencias
abriraqui

Zero waste, just rice and TimeWithZone #hackership

Posted on December 15, 2013December 28, 2013

Tweet

It was the fifth time but it happened again, I forgot that it was Thursday and time for Betahaus breakfast. But I must say that this time I was happy to be able to have breakfast. Normally I don’t leave home without having breakfast, but today, I was going to be late for the stand up round, so I decided that I preferred to go walking and have breakfast after.

Just riceAs every week, there were startup presentations, this time caught my attention the fact that it was a very simple idea, it was about buying «Just rice», that is their company name, and that is what they do, sell just rice. The idea behind is to get rid of packaging, there is so much plastic even in bio-eco-friendly products, that is really annoying, so this time the idea is to go to the past where people went to the shop with its own bag, pot, bottle to have it refilled, so you just paid for the filling, in this case just rice, but could be any kind of thing. After the Just rice talk I got 1kg of just rice, to try it, the rice comes from Italy, is risotto rice, so I”ll have to try to cook risotto 🙂
Afterwards, talking about this at lunch I came to know  Zero Waste   an initiative to do also what the name means Zero waste, cool!!

Then it was time to go back to the calendar and its always «welcoming» date types, grrr … I spend some time reading about the different date type is Rails, that can be summarize in the fact that Time has become an abstraction of dates and times  , so that they take into consideration Timezones, so I was all messed up because I was storing datetime objects, expecting to retrieve them too, but then realizing that what I got back was  ActiveSupport::TimeWithZone , Rails has decided to implement always times with timezone included, but if you don”t know you just go crazy, but that was until I read ActiveRecord, DateTime, Time, and time zones
I had a problem, I wanted to show the events grouped by day in the calendar, my dates where supposed to be datetime type, i got ActiveSupport::TimeWithZone, so I could not access the the hash key value because it was on the wrong format, and did not know how to convert it from one to the other. Finally after asking, an easy solution, convert both into strings and compare strings is always easier, done and working 🙂

So I had in the events controller

@events_by_date = @events.group_by(&:day)

which returned ActiveSupport::TimeWithZone
Then changed it to

@events_by_date = @events.group_by { |i| i.day.strftime("%Y %m %d") }

and now in the view so that the events could be retrieved I had to

Maybe not having all the code it”s a bit confusing but you can always check this commit on github

After this, I began doing some ajax stuff, I”m a bit lost with it but following the guides and checking railscasts always helps 🙂

DB workshop at SoundcloudBut the day was not over, the end of hackership day meant the beginning of the afternoon, today at hackership J. from SoundCloud came to stay with us at hackership and then offered us to join a workshop he was going to hold about the basics of how databases work. He insisted that maybe too basic for us, but still for me was interesting, I have to «desenpolvar» so many things in my head that is great to revise things but I was not only interested in revising but also in seeing someone teach it, basic things often are the most difficult to teach and I must say he did it great, I learned things and revised other, so cool.

And still the day was not over, Diaspora meetup was taking place in the afternoon, so although it was quite late, I wanted to try to arrive there and see the people, but no luck, too late. In any case tomorrow I”ll be installing our Diaspora pod, let”s see how it goes.

3 thoughts on “Zero waste, just rice and TimeWithZone #hackership”

  1. T James Corcoran says:
    December 15, 2013 at 5:30 am

    > that was until I read ActiveRecord, DateTime, Time, and time zones

    So glad that my ramblings were of use to you!

    Hack on!

  2. lilithlela says:
    December 15, 2013 at 5:30 am

    RT @carolina: Zero waste, just rice and TimeWithZone #hackership http://t.co/vJHebs5Lzv https://t.co/5tR9e47ggX

  3. NanaSilvergrim says:
    December 15, 2013 at 5:42 am

    RT @carolina: Zero waste, just rice and TimeWithZone #hackership http://t.co/AD8ZT9CMAf https://t.co/dMnM1yhqUk

Comments are closed.

©2023 abriraqui | Powered by SuperbThemes & WordPress