some of my favorite ruby gem names

hoe, factory girl, rack, naked_rack, deepthroat, punch, shnork, rubbr, beer, pony, strap-on, cheeba, babygitter, backnob, badger, syckle, birdfeed, hosebird, grackle, hammock, sunspot, birdie, hubris, corrupt, gambler, paranoia, peeping, statwhore, slubydoo, slug, crack, ragweed, wee, grudge, inquisition, honkster-jelly, harker, tinkerbell, jacker, mockery, bullshit, i_dont_give_a_shit, monkey_shield, biomass, ass, massive-nancy, sassafras, clingwrap, scraper, castronaut, feedbag, bullet, snailgun, railgun, cap_gun, railgun, shotgun, punch, throat-punch, one_inch_punch, puny, shadow_puppet, hightimes, tadpole, hobosupport, runt, fugit, stammer, curly_mustache, rasta,crazy_ivan, floobs, loofah, boogaloo, mole, syrup, featherdust, grit, crow, pangea, panda, sunspot, japanese_av_actress, hurl, watcher, obsidian, glue, disguise, needle, junebug, jungle, petticoat_junction, juggernaut, jello, honkster-jelly, wizardly, crocodile, stump, burn, fire-hydrant, homeschool, fast_hammer, dutchfaker, fabricator, facade, fattr, profanalyzer, masochism

Posted by jeremy Fri, 16 Apr 2010 17:02:00 GMT


Things I learned the hard way XIVII

jQuery When the DOM isn't reacting to your javascript selectors as expected try a little specificity: instead of this:
  $("#item_id > a")
do this:
  $("#item_id > ul > li > a'")

Posted by jeremy Sun, 14 Feb 2010 23:41:00 GMT


Snow Leopard 10.6 Rails/Passenger

Got this error when loading a rails site served under my local apache"
*** Exception RangeError in PhusionPassenger::Railz::ApplicationSpawner (integer 4294967294 too big to convert to `int') (process 1097):
I updated my passenger gem and regenerated the apache passenger module, updated the httpd.conf at it was all good after that.

Posted by jeremy Sat, 05 Sep 2009 23:10:00 GMT


Javascript Exceptions - testing for true - When is undefined actually undefined?

Javascript has to know what 'it' is before Javascript can tell if 'it' is what you want 'it' to be. Example:
if (unreferencedVariableName) { alert('Impossible! an unreferenced variable cannot return true. In fact it cannot return at all!'); }
Result: ReferenceError: unreferencedVariableName is not defined
/* is as true as the unescapable pain and suffering of being an alive human being  */
if (typeof(cowBoySuckMonkey) === 'undefined') { console.log('suck it!') }


/*   these are false - no if-fu for you!   */
if (typeof(cowBoySuckMonkeee) != 'undefined') { console.log('suck it again!') }
if (!typeof(cowBoySuckMonkeee)) { console.log('suck it for real!') }

/* 'undefined is something I guess - just not what I wanted to test against */
if (typeof(cowBoySuckMonke)) { console.log('suck it nut gobbler!') }

var cowboySuckMonkay = '';
if (typeof(cowboySuckMonkay) != 'undefined') { console.log('suck it empty string!') }
/* no joy */
if (typeof(cowboySuckMonkay)) { console.log('suck it empty string, part duex!') }

/* well, I guess an empty string is false - CaulkGobblin! */
if (cowboySuckMonkay) { console.log('suck it empty string, you still not true!') }

if (cowboySuckMonkay == '') { console.log('suck it empty string, now you true!') }
so much to remember…

Posted by jeremy Tue, 18 Aug 2009 22:06:00 GMT


comparison of Fixnum with String failed

Where the error occured

Rails 2.1.2 / bundle_fu / Javascript file

Why the fu…?

A javascript files that ends with a line commented out. -1 is being compared to an empty string.

Fix

Add a blank line at the end of the Javscript file(s) that end with commented lines.

Posted by jeremy Sat, 15 Aug 2009 14:45:00 GMT


snipdbits

I've been rocking the Javascript one liners lately. Syntax like this is way not noob friendly.
// both are the same
  if ( 0 == 0 && 0 === 0)
    alert('0 is equal to 0, and 0 is the same value and object type as 0');


  if ( 0 == 0 && 0 === 0)  alert('0 is equal to 0, and 0 is the same value and object type as 0');

Posted by jeremy Thu, 06 Aug 2009 15:28:00 GMT


designation agitator

My favorite class name when styling a page is ‘padahoe’. If anyone ever asks what it stands for I’ll tell them “pad a horizontally oriented element”. Lies, damn lies, statistics.

When I commit to git I tend to flavor my commit messages with humorous snark, usually related to how something in the application is deviously circumventing my attempts to enforce my authority. My logic is shot through with regression insurgents.

Posted by jeremy Thu, 02 Apr 2009 21:14:00 GMT


jrails link_to_function hackaway

<%= link_to_function( "insert it", :id => 'foo') do |page| 
      partial = escape_javascript(render :partial => "my_partial", :object => Object.new)
      page <<  "$('#my_div').append('#{partial}')"
    end %>

Sweetness.

Posted by jeremy Wed, 01 Apr 2009 08:56:00 GMT


happens not adderall in the business of

all lies – less pain to just use current_user and accept the inaccurate naming of the models intent in the instance variable.

fuckin’ fuck, man.

I use restful_acl gem and the restful_auth plugin – restful_auth has generators so that when you create the restful authorization model it will take your class name and fill in the places where it needs to go I have an account model instead of a user model so it filled in all of the instance variables for authenticated user methods with current_account. The restful_acl gem is hardcoded to the current_user instance variable. So I opened the module and method in a file in /lib called restful_acl_controller_hacks.rb so I could alias current_account to current_user.


module RestfulAclController
  module ClassMethods
    def has_permission?
      alias current_user current_account
    end
  end
end

Then I required the file in the application controller:

  require 'restful_acl_controller_hacks'

Now has_permission? works and my specs pass and all is right with the world. For about 2 minutes until I smash into another coding wall due to my lack of experience and inability to remember most things of importance related to OOP.

Posted by jeremy Sat, 07 Feb 2009 02:56:00 GMT


stupid arguments

rspec controller specs: YourClass.should_receive(:find).with() really cares about argument order and does not accept a hash of values where the params[:key] is named like the key in the hash key => value so:
## controller code
def find_my_fucking_shit
  @my_class = MyClass.special_method_in_model(params[:shit], params[:not])
end

## controller spec
# This will fail and you will want to punch a bitch in the nose because you spent two fucking days 
# figuring you were just really goddamn stupid (which may be true) because it should work but it doesn't
it "should find shit" do
  MyClass.should_receive(:special_method_in_model).with({:shit => 'will', :not => 'work'}).and_return(mock_my_shit)
  get 'find_my_fucking_shit',  :shit => 'will', :not => 'work'
end


# This will pass
it "should find shit" do
  MyClass.should_receive(:special_method_in_model).with('will', 'work').and_return(mock_my_shit)
  get 'find_my_fucking_shit',  :shit => 'will', :not => 'work'
end
Yes, I know about hash_including(). For some reason it failed because ":action => '_controller_action_', :only_path => true" was being included in the with() arguments hash and it made the should_receive fail - even though hash_including is supposed to deal with this. It may be a rspec_rails thing. I have not dug into the rspec code very deep to see what I was doing wrong or if it's a bug or if the universe just hates me.

Posted by jeremy Thu, 22 Jan 2009 06:44:00 GMT