Sunday, August 8, 2010

Stupid Rails Gothcha 01

Ok, here's one of those "I just wasted X hours, damn it!" moments. I installed Cucumber into a Rails App that uses the shopify_app plugin. And it keept giving me strange errors when running
rake cucumber
Turns out I should have installed Cucumber first then when I generated the shopify stuff it would have setup a correct `shopify.yml` and in the end all I needed to do was duplicate a few lines in `shopify.yml`. Remember all your environments need to know about your api key.

I hope this helps someone.

Saturday, April 3, 2010

Code Snippets in Blogger!

I finally found a way to put code snippets into blogger. Thanks to Carter Cole for his Awesome Syntax Highlighting Made Easy post.

The trick is using a brilliant javascript/css hack by Alex Gorbatchev.

Thanks Guys!

Now if only google would build something like SyntaxHighlighter into blogger, so we don't need to hack blogger just to post code to our blogs!

Stupid Rails Gothcha 00

Ok so, its another of those situations, where I spent way too long trying to track down strange behavior in my code, and I don't want to repeat the process. So I'm writing it down to help myself remember. And maybe just maybe someone else will find this post and save themselves a couple of hours.

So here's the situation I have two very similar views for different models. On one the footer mysteriously shows up in the middle of the page and the other works fine with the footer showing up at the bottom like it should.

It turns out that rails views, at least ".html.erb" ones, cannot handle comments in
<% %>
blocks. I had code like:

<% for @collection.each do |thing| %>
    display thing ...
<% end #each %>

Which caused the footer in the middle issue. When I changed it to:

<% for @collection.each do |thing| %>
    display thing ...
<% end %>

The view was fixed and the day was saved! What the fuck rails, comments should never ever break things! Grrr, anyway live an learn and remember no comments in your views, lest the rails daemons become angry.

Monday, January 25, 2010

Stupid Authlogic Trick 0

I'm helping a friend setup authlogic and we both ran into issues when trying to setup test accounts. So remember kids, when creating a user that uses authlogic's acts_as_authentic you must set both :password and :password_confirmation. 


Also you can get surprisingly  far without  actually putting acts_as_authentic in your user model. So don't forget that one either.

Sunday, August 23, 2009

This is truely frightining!

Apparently New Jersey is batshit and so is this judge.  How can "no person shall be deprived of the inestimable privilege of worshiping Almighty God" possibly be part of a state constitution? It's so completely out of line with the Bill of Rights.

Beyond that I call into question the judgment of Mr. Camarata. How can the religious/anti-religious views of the parent be considered to "deprive" the child of her "privilege" to worship "Almighty God"? At worst this clause prevents the parents from from forbidding their daughter from worshiping "Almighty God", or otherwise preventing her from doing so.

Hopefully the Burkes win their appeal and Mr. Camarata gets disbarred for gross incompetence.  

Blog Conversion

I just converted www.madscienceguild.org from a bluehost+wordpress blog to a blogger blog! I didn't feel like paying to renew hosting with bluehost, so I decided to just move it over. The process was pretty simple once I found wordpress2blogger.appspot.com which allows you to convert your wordpress export xml files directly to blogger export files which can then be imported into blogger. Huzah!

Thursday, August 6, 2009

git - One command to rule them all.

I have only recently learned the joy that is git. For the longest time I thought "SVN works for me why learn a new version control system." Well, as cliche as is sound, you don't know what your missing until you've used it. Two things really impress me with git, the ease of branching and the ability to "commit changes" to a local repo without "push"ing them to the main repo. These two features really put git significantly above Subversion.

Needles to say, after seeing the light and deciding that git is the way, I wanted to migrate one of my subversion projects to git. So I googled "converting svn to git" and found quite a few answers out there. The OS X solution was:

port uninstall git-core
port install git-core +svn

and...
git-svn clone SUBVERSION REPO

However after running the uninstall and reinstall no magical git-svn command showed up. This frustrated me to no end for the better part of an hour. Until I found a blog post that informed me that git had spiffied up the git tools. The new syntax is apparently:
git svn BLAH BLAH BLAH

So essentially a series of 'git-*' commands have all been distilled down into the main 'git' command, which is really neat. Less executables to clutter up tab completion lists, and one stop shopping for all your git needs. I think this is really important so let me repeat it, commands like "git-svn" have for the most part been replaced with "git svn". Spread the word.