Tumgik
mattpolito · 4 years
Text
D1: The Minecraft nether update is just showing me all the new ways i can die... it's like Australia.
2 notes · View notes
mattpolito · 6 years
Text
D1: My current marriage strategy is to 1. Fall in love and 2. Marry rich... so i can eat potatoes all the time.
Me: You can move to Ireland and eat potatoes all the time!
2 notes · View notes
mattpolito · 8 years
Conversation
Did that taste funny?
D3: Hey sister you want this piece of my potato?
D1: Sure. **takes piece and eats it**
D3: Did that taste funny?
D1: I don't think so, why?
D3: CAUSE I FLOOFED ON IT.
1 note · View note
mattpolito · 8 years
Conversation
If you eat a baby
D3: If you eat a baby would you get a tummy ache?
Me: If you eat a baby?
D3: Yeah
Me: Well I certainly hope so
D3: Hmmm, I think you'd only need a drink of water.
0 notes
mattpolito · 9 years
Text
Rails Quick Tips - ActiveRecord::Calculations.pluck
ORIGINALLY POSTED ON THE HASHROCKET BLOG
Pluck is an ActiveRecord calculation method introduced in Nov 2011 and is designed to return a collection of values by performing a single column SELECT query as direct SQL.
Now what problem could this help solve and how does it affect us?
How often have you run into some code similar to this?
users = User.all => [#<User id: 1, email: '[email protected]', active: true>, #<User id: 2, email: '[email protected]', active: false>] users.map(&:email) => ['[email protected]', '[email protected]'] # I've separated the AR result from the ruby #map for clarity # this would normally be called as User.all.map(&:email)
What is happening here?
We are returning all records of the User ActiveRecord object and asking for a new collection containing each email. It definitely gets the job done... do we really need to fix this? Possibly. That decision will definitely be up to the person implemented but let's explore a different way to get the same result in a more efficient and performant way.
ActiveRecord's .select will return AR records as the result, but will only return with the explicitly requested attributes. The User class is still being instantiated for each result. Depending on your memory constraints this may not be a problem, but nevertheless it's using up memory that just didn't need to be used.
emails = User.select(:email) => [#<User email: '[email protected]'>, #<User email: '[email protected]'>] emails.map(&:email) => ['[email protected]', '[email protected]']
We're getting closer. At least we are now only pulling back the data we care about. This is only marginally better than our first attempt and it feels weird. We've asked to only select a particular attribute and then we have to ask for it to be the only thing in a collection.
Lets try one more time using the pluck method.
User.pluck(:email) => ['[email protected]', '[email protected]']
Whoa! Well that's a bit different. Definitely less code but what is it doing? .pluck is a (misplaced?) calculation method that, like described above, is returning an array of results based on the database column that was requested. Where the previous example returned full AR User records and then performed the map, this example went directly to the database with a SQL call and returned only the result needed. In many cases this is far cleaner and definitely more efficient.
In addition, other relation methods can be chained together and affect the end result query that is generated.
User.where(active:true).pluck(:email)
SELECT email FROM 'users' WHERE 'users'.'active' = 't'
0 notes
mattpolito · 9 years
Conversation
Meat Moisturizer
Daughter 1: Check out this Lego outdoor kitchen I made!
Me: OK
Daughter 1: Over the stove I put salt, pepper, dill, and meat moisturizer.
Me: Meat moisturizer?
Daughter 1: Uh yeah, that's what you use to keep meat moist!
0 notes
mattpolito · 9 years
Text
Katrina Owen - Scottish Ruby 2012
ORIGINALLY POSTED TO THE HASHROCKET BLOG
While attending the Scottish Ruby Conference, I had the great opportunity to meet some really interesting people. Over the next few days I'd like to share with you interviews I had with presenters of what I consider the top talks of the conference.
Today we are concluding our journey with Katrina Owen. Her talk is titled Therapeutic Refactoring and was by far my favorite of the conference. I got a chance to catch up with Katrina and asked about the talk and how it has evolved.
Make sure to check out the video of her presentation below. Pay attention to her delivery of the material. Much of it was very deliberate and I feel a great example of giving a talk.
vimeo
You can also check out her presentation: Therapeutic Refactoring
0 notes
mattpolito · 9 years
Text
Joseph Wilk - Scottish Ruby 2012
ORIGINALLY POSTED TO THE HASHROCKET BLOG
While attending the Scottish Ruby Conference, I had the great opportunity to meet some really interesting people. Over the next few days I'd like to share with you interviews I had with presenters of what I consider the top talks of the conference.
Today we are going to continue our journey with Joseph Wilk. His talk was titled Someone is Wrong and really showed the audience that development is not necessarily about technical skill.
Here is Joseph speaking with me about his talk and how it came to be:
vimeo
You can also check out his presentation: Someone is Wrong
0 notes
mattpolito · 9 years
Text
Ben Orenstein - Scottish Ruby 2012
ORIGNALLY POSTED TO THE HASHROCKET BLOG on AUGUST 6, 2012
While attending the Scottish Ruby Conference, I had the great opportunity to meet some really interesting people. Over the next few days I'd like to share with you interviews I had with presenters of what I consider the top three talks of the conference.
Today we are going to start our journey with Ben Orenstein. His talk was titled Refactoring: from Good to Great and was the best example of live coding I have seen. Here is Ben speaking with me about his talk and how it came to be:
vimeo
You can also check out his presentation: Refactoring: from Good to Great
0 notes
mattpolito · 9 years
Text
Daughter 1: I wish I was kissed by a radioactive butterfly. Me: goes looking for old Godzilla movies
0 notes
mattpolito · 9 years
Text
Kid at park to Daughter 1: points to Daughter 3 hey she’s too small to play laser tag.
Daughter 3: shoots kid
Me: smiles
0 notes
mattpolito · 9 years
Quote
No lasers at the table
Me
0 notes
mattpolito · 9 years
Quote
I feel like my underwear are made of spiders... and they're crawling up my butt
Daughter 2
0 notes
mattpolito · 9 years
Quote
If you're a theoretical performance devotee, well, you're probably not writing Ruby anyway
Lawson Kurtz
0 notes
mattpolito · 11 years
Quote
They sound a little tired and frustrated, don't they? That's the sound of legacy code.
Giles Bowkett - Rails as She is Spoke
0 notes
mattpolito · 12 years
Link
Tired of writing long git paths to github repositories in Gemfile? Then you will find this useful. When the repository you need is public, you can use :github shortland instead of :git. And just specify github username and repository name separated by slash.
If repository name and username...
6 notes · View notes
mattpolito · 12 years
Text
The Last Train
"No distance of place or lapse of time can lessen the friendship of those who are thoroughly persuaded of each other's worth." -- Robert Southey
It occurred to me that once I stepped onto the train this morning it will be my last time for what will probably be quite a while. Moving to a new state at the end/beginning of a year really drives the point home. There is a definite feeling of closure and new opportunity.
That got me thinking about my journey ahead and how I ended up at this point. I'd like to thank the people around me that helped define who I am in my career path.
It pretty much started with myself and a pirated copy of Agile Web Development that led me to find others interested in Ruby programming. It was a tough time but that is when I stumbled into Ray Hightower leading a Ruby Meetup in a library meeting room. Thanks Ray, my involvement in ChicagoRuby, I feel, is what really moved my career into the fast path.
Next up is Dave Giunta, Courtney Braafhart, and Jim Hassan who believed in me enough to take a chance and give me my first full-time Ruby dev position. Thanks... I was crazy nervous trying to play it cool in my interview (with my pinstripe suit). This is also where I met Adam Walters, Chris Hallendy and Stephen Korecky. Who have become good friends and I'm always learning from each of them.
This is about where I attended an Obtiva TDD Bootcamp taught by one Dave Hoover. Dave must have been semi impressed with me cause he asked if I was interested in trying out for Obtiva shortly after that. Of course I jumped at the chance to work along side people I looked up to in the dev community. So thanks Dave Hoover, Kevin Taylor, Todd Webb and Kat Reid. That quadruple interview was intense and I know I bombed Kevin's interview but again... thanks for believing in me.
I can say that once I started with Obtiva it was Noel Rappin, Joe Banks, and Chad Pry that really put up with me and taught me to become a half way decent dev.
Now my journey continues to Florida to join the Hashrocket family. It is my honor to be a small part of another great dev shop. So thank you, Hashrocket, for taking me on and letting me continue this crazy career path I've set myself on.
To all who were mentioned and those that were not… thanks for the friendship and experiences. They will not be forgotten.
0 notes