I Am Rails (And So Can You!) at RuLu 2012

I don’t know if the video from Campus Party Europe is up yet, but this from when I gave the same talk at RuLu in June.

Video | Posted on by | 2 Comments

Ordering CSS pseudo-elements (and pseudo-classes)

Look out for the order you use CSS pseudo-elements in, or you may not get the results you want. Today, I found that using li:before:first-child doesn’t work to style the :before pseudo-element on my first li, but li:first-child:before does.

Rather than chaining together the way something like .title.example (which would select element with both classes “title” and “example”, regardless of order), the pseudo-element order matters. So li:before:first-child is styling the first child of the li:before element, while li:first-child:before is styling the :before pseudo-element on the first li.

In fact, in looking up the documentation to link below, I realized that :first-child is actually a pseudo-class, rather than a pseudo-element. The docs below don’t state it, but it’s possible that in order to get correct behavior, the pseudo-class should always come before the pseudo-element.


Posted in Uncategorized | Tagged , , | Leave a comment

I’m amazed

Wow! I had no idea my talk would generate so much interest, and so much traffic to my blog! It’s really strengthened my resolve to write here regularly. I want to continue being a resource for budding programmers, and (dare I hope?) an inspiration to people who want to become programmers. Thank you all!

Posted in Uncategorized | 1 Comment

How I taught myself to code and got a programming job in under a year

I gave a talk at Rails Girls Berlin today about how I learned to code all on my own and turned it into a job. There have been several requests already to see the slides, so I wanted to get them up right away. I hope to add all the links in the talk as links on this article soon, as well as additional resources that I didn’t have time for in the talk. For now, enjoy the slides!

[update (5 May 2013)] I gave a slightly revised version of the talk at the Rails Girls Berlin 1st Anniversary workshop. The revised slide deck can be found here. [end update]

My projects

Rails, Git, Heroku, and Stack Overflow

Development Tools

  • Rubular (experiment with regular expressions, a.k.a. ‘regexes’)
  • Markdown (simple formatting used by Github and Stack Overflow for user comments; can also be used for user input from your projects!)
  • Pow (Mac-only local server tool; you can use this instead of firing up rails s)

Design Tools

Posted in Uncategorized | Tagged , , , , , | 4 Comments

Using cookies in RSpec tests

I spent way too long today figuring out why a test for my update method was failing. Short answer: RSpec cookies don’t play nicely with Rails 3 testing, or at least not with Rails 3.1.rc5.

The relevant bits of the final code, with comments, can be viewed in this gist.

I first had to figure out why I was getting a nil.update_attributes error. I ruled out the absence of my record, then lost time thinking that the test was somehow losing the hash of values I wanted to update to, before realizing that the big difference between my test and my actual code (which was already working fine) was the absence of the cookie used by the update function to find the correct record.

The next big hurdle was finding out why cookies[:subdomain_name] = "my_subdomain" didn’t actually set anything, or at least anything I could retrieve. This thread from ruby-forum.com was crucial in helping me understand what was happening, and two threads on StackOverflow helped me figure out the syntax I needed.

Posted in Uncategorized | 1 Comment

GitX tip

I was using a version of GitX from what appears to be the original source at gitx.frim.nl. It’s been acting really weird, doing things like not hiding the program and not responding to simple requests for new windows, and I thought perhaps it was related to my recent upgrade to Lion. I looked around, and gitx.laullon.com maintains a much more recent codebase for your download pleasure, which you can inspect at laullon’s github repository. Download, unzip, run, done. Same program, but much better behavior.

Posted in Uncategorized | Leave a comment

New mistake of the day

Today, I made git commits on no branch. I didn’t know it was possible, but apparently so! It happened when I opened a second shell of the directory I was working in, and I assumed that it would maintain the branch information. It didn’t.

I managed to make a merge back in, but I had to use GitX (a GUI for git) to do it. I have no idea what the syntax is for telling git to merge from (no branch). I tried it just like that, but got an error for having parentheses unexpectedly. I opened GitX to take a look around, and the first thing I selected in the tree history (sorry, can’t recall what it was) threw an error and took me to the commit window to resolve my conflicts for the merge. Of course, I had to do the actual edits for the conflicts in my usual editor (MacVim), and then GitX forced me to run the commit from the command line, but at least it got me started and off of my no-branch purgatory!

Posted in Uncategorized | 4 Comments