Posts filed under 'Professional'

Let Me Code Lyrics

Someone asked for the lyrics to my recent presentation at RailsConf. Enjoy!

The screen glows white on my laptop tonight

And my rspec won’t go green

I’m coding in isolation,

So my PRs are obscene

My doubts are howling like this swirling storm inside

Couldn’t keep it in;

Heaven knows I’ve tried

Don’t let them in,

don’t let them see

my github repos are mortifying me

Conceal, don’t feel,

don’t let them know

Well now they know

Let me code, let me code

Can’t hold it back anymore

Let me code, let me code

I want to play with rails 4.0.4

I don’t care

what they’re going to say

Let the nerds rage on.

The trolls never bothered me anyway

It’s funny how some distance

Makes everything seem small

And the impostor syndrome

Can’t get to me at all

It’s time to see what I can do

To test the limits and break through

No right, no wrong, Sandi’s rules for me,

I’m free!

Let me code, let me code

Matz is my favorite guy

Let me code, let me code

DHH will never see me cry

Here I stand

And here I’ll stay

Let the nerds rage on

My SQL queries fetching data that it found

I’m using ruby to draw frozen fractals all around

And one thought’s solidifying like an icy blast

I’m never going back, the past is in the past

Let me code, let me code

When I’ll rise like the break of dawn

Let me code, let me code

That perfect girl is gone

Here I stand

With the apps I’ve made

Let the nerds rage on

The trolls never bothered me anyway!

p.s.
The code to create those “frozen fractals” was found here:
 http://singlebrook.com/blog/explore-mand…

1 comment April 25th, 2014

Let Me Code

I’m a total fraud. How in the hell, did I end up with a speaker ticket?

When I attended my first railsconf back in 2011, I was a self-proclaimed novice despite the fact that’s I’d been coding rails professionally for two years, despite the fact that I had over 10 years coding experience in other languages prior to that. Obviously, I wasn’t a professional since I had yet to write my first test. Obviously, I was a fraud.

I came to railsconf 2011 to become a ‘real developer’. My lack of testing knowledge branded me as an outsider, and until I could learn ’the right way to code’ I’d never be ‘real’.

Wish I had known back then that I’d come back to railsconf later to hear DHH call TDD a ‘fad diet’. Dunno if I would have felt less like a fraud, but it helps that nowadays folks are challenging the notion that you HAVE to code one way or another.

Don’t get me wrong. I think the foundations are important, patterns and testing are important (sorry DHH), and learning from others is what makes this community great. But you have to keep moving forward even when people keep telling you ‘you’re doing it wrong’. Because everyone will tell you that, all the time. Even if you’re DHH… actually especially if you’re DHH.

It’s been a long journey for me leveling up my game, feeling like I finally can hold my own in a room of ‘real software writers’. But now I see a room full of people just like me, and even more people just like me three years ago. They’re here to level up, to become ‘real developers’… maybe not knowing that they already are ‘real’.

Add comment April 23rd, 2014

Omg, OMG!

I’ve been invited to “speak” at RailsConf!

Yeah, I meant to use quotes because my talks generally involve alternate lyrics to popular songs with tech jokes thrown in.

Since my “talk” isn’t the traditional 40 minute discussion I will be the opening number for the lightening talks on Thursday evening.

I am so excited, and only slightly terrified.

Add comment March 5th, 2014

My Journey through Deprecations

Check out my vocal presentation at Boston Ruby Conf this year! This was so much fun.

I love the Boston ruby community, who is willing to endure my brand of ridiculous. Thanks guys!

Add comment October 30th, 2013

Wicked Good Ruby, you going?

Thanks to the generosity of the folks over at Thoughtbot, the upcoming Wicked Good Ruby conference in Boston is proud to announce that childcare is being offered through Parents in a Pinch. Please contact me at liana at liana dot org if you are interested.

In addition, Jumpstart Labs is offering a Refactoring Rails Workshop to be held on Friday before the conference. And afterwards, I hope to see you at the Wicked Good Lightening Talks. If you are interested in speaking please contact brian at dockyard dot com

Wicked Good Ruby has only 50 tickets left, so now is the time to sign up!

Add comment September 15th, 2013

AutosaveAssociation

Recently, I wanted to utilize the AutosaveAssociation module which (wrapped in a transaction) autosaves a model record when the parent is saved. I’ll use the example from the api docs:

post = Post.new(title: 'ruby rocks')
 post.comments.build(body: 'hello world')
post.save # => saves both post and comment

But because I had a validation on comments that requires presence of post, it was attempting to validate comments before post was created. So instead of saving all my models in one swoop, it threw a validation error.

Wut? This should just work! I fussed with it for hours and the only workaround appeared to be to call save with validation: false.

Ew. Anyone else feel queasy?

Turns out the missing piece was to add inverse_of on my model associations. Here’s an awesome explanation from my coworker @mdaubs83:

The :inverse_of option is needed here to inform AR about the inverse association so that the Comment instance returned from build() can reference the original Post instance. This in turn allows the Comment instance to see the id of the Post instance after it’s saved and update it’s foreign key accordingly when AutosaveAssociation calls save() on associated objects. There are other benefits to using :inverse_of, we should probably consider adding the option to all associations. Here’s evidence of the issue and how adding inverse_of solves it:

 post.comments.build(user_id: user.id)

# has_many :comments
 post.comments.first.post.object_id == post.object_id
 # => false

# has_many :comments, :inverse_of => :post
 post.comments.first.post.object_id == post.object_id
 # => true

See also “Bi-directional associations” in Rails API Docs

Thanks, Matt! Sadly, inverse_of is never mentioned in the AutosaveAssociation docs. But I noticed this line in the ActiveRecord Association docs.

If you are using a belongs_to on the join model, it is a good idea to set the :inverse_of option on the belongs_to, which will mean that the following example works correctly (where tags is a has_many :through association):

@post = Post.first
@tag = @post.tags.build :name => "ruby"
@tag.save

The last line ought to save the through record (a Taggable). This will only work if the :inverse_of is set:

class Taggable ActiveRecord::Base
  belongs_to :post
  belongs_to :tag, :inverse_of => :taggings
end

Err. Okay. Would have been useful to see that little tidbit included in the AutosaveAssociation docs as well!

But good news! Matt also tells me that Rails 4.1 is poised to support automatic inverse_of detection. So once we all upgrade we get inverse_of goodness for free. W00t!

Commit d6b03a3 to rails/rails by wangjohn
https://github.com/rails/rails/commit/d6b03a376787ec9c9e934e5688a38c576f2e39b7

Add comment June 26th, 2013

Y U No Validate Me?

I have a class that inherits from Active::Model that is encapsulating some logic from other models. Problem is, I’d really like my object to display validation errors. All of them.

There are attributes on my ActiveModel class, and then I need to validate attributes on the ActiveRecord classes that are being updated here as well.

Yeah, I’m pretty sure that I’m not the only one who initially thought that self.errors returns an array of errors. It doesn’t. It returns the Errors object.

If you want to add to your errors object, turns out you gotta get friendly with Validations too. They go hand in hand.

It’s in the valid? method where all the magic happens. Check this out:

  def valid?(context = nil)
    super
    my_model.errors.each{ |k, v| self.errors[k] << v } if my_model.invalid?
    errors.empty?
  end

Ah, sweet validation.

Add comment June 20th, 2013

Tip of the Day

I’ve only ever used Date.today and Time.now to get the current date and time. But for those of us concerned with global timezones (and who isn’t), we should really be using the .current method.

Date.current is a rails core extension that gets the current date in the set time zone.

Awesomesauce.

Add comment June 19th, 2013

Favorites

Sometimes, I wanna set more than one var at once. This is one of my very favorite ruby tricks that I use every day:


irb(main):007:0> a = [1, 2, 3]
=> [1, 2, 3]
irb(main):008:0> x, y, z = a.collect{|i| i * 2 }
=> [2, 4, 6]
irb(main):009:0> x
=> 2
irb(main):010:0> y
=> 4
irb(main):011:0> z
=> 6

1 comment May 23rd, 2013

The Artists Way

Is comparing software engineering to a career as an artist way off base? What does the term ‘disruptive innovation’ mean to you?

One of the basic tenants of wisdom in The Artists Way is to take good care of yourself.  This book is known in the art community as a guide toward unlocking creativity.  I have seen these same strategies espoused when folks discuss how to enhance productivity.

What the hell does becoming a more creative person have to do with productivity and becoming a better programmer?  I guess that depends upon your definition of ‘better’.

No one expects a composer to sit at the piano 60 hours a week churning out symphonies. Prolific writers don’t sit at their desks for endless hours either. The idea is ridiculous.

Well documented is the fact that productivity goes down when the work week exceeds 40 hours. Programming is hard mental work and sitting for prolonged periods of time doesn’t help either.

I have spent the last few years exhausting myself trying to “level up” as a rubyist. I can honestly say that my best work and ah-ha! moments occurred when I was awake and refreshed. And when my mentors were awake and refreshed as well.

One of my favorite exercises from the book is The Artist’s Date. It’s a once-weekly, festive, solo expedition to explore something that interests you to spark whimsy and encourage play.

How many times have you solved that vexing problem the moment you stepped away from your desk? When do your best solutions pop into your brain? When you are tired, beat down and depressed?

Thanks to Luminosity, I have first hand, tangible evidence that my brain improves with a regular diet of sleep, creativity and connection with my family.

This is the part where I share my personal brain performance index starting from a deeply stressful, sleepless period in my life to a much happier place. These are sans numbers of course but you get the idea…

BMI

This success is due to a strong effort on my part to truly seek out work life balance. I’m a better mom and a better programmer today. What steps have you taken in your life to not only become a better and more productive programmer, but to become a better YOU?

Add comment March 24th, 2013

Previous Posts


Pages

Tweets

When online shopping, I wish you could select a woman matching your body type to model the outfits. Boyish waifs tell me nothing!

About 2 days ago from Liana Leahy's Twitter via Twitter Web Client

Meta