Joined May 2011
·

glaszig

Berlin, Germany
·
·

i'd suggest a variant of the gem install command that does not depend on a specific version of mysql.

gem install mysql2 -v '0.2.18' -- \
  --with-mysql-lib=$(brew --prefix mysql)/lib \
  --with-mysql-dir=$(brew --prefix mysql) \
  --with-mysql-config=$(brew --prefix mysql)/bin/mysql_config \
  --with-mysql-include=$(brew --prefix mysql)/include

it should even be possible to be simplified down to

gem install mysql2 -v '0.2.18' -- \
  --with-mysql-dir=$(brew --prefix mysql)

because the extconf will derive mysql-lib and mysql-include from the mysql-dir argument.

and if you know you have a working mysql_config you should be able to use just

gem install mysql2 -v '0.2.18' -- \
  --with-mysql-config=$(brew --prefix mysql)/bin/mysql_config

and extconf will call it with arguments to extract proper flags:

$ mysql_config --libs
-L/usr/local/Cellar/mysql/5.7.17/lib -lmysqlclient -lssl -lcrypto

$ mysql_config --include
-I/usr/local/Cellar/mysql/5.7.17/include/mysql
$ gem list rails

*** LOCAL GEMS ***

rails (4.2.0, 4.2.0.rc1, 4.2.0.beta2, 4.1.8, 4.1.7, 4.1.6)
$ rails _4.2.0_ new foo
Error: Command '_4.2.0_' not recognized
Did you mean: `$ rake _4.2.0_` ?

Usage: rails COMMAND [ARGS]
...
Posted to Bullshit Interviewers over 1 year ago

i love those stories about interviews. until now, i was lucky enough not having to had to experience such bullshit interview. the stupidest thing was "yeah, we really want you but please wait 6 months 'til we hired a senior." -- after 3 rounds of oral and whiteboard tests.

i ended up with my current position without an interview and for the foreseeable future i don't plan to ever have one again. unless "apple calls" and this won't be happening ;)

Posted to Rails 4 Scopes and as_json response over 1 year ago

great. without digging into it i always wondered how to achieve this. thanks.

might come in handy for my plans for Starve ;)

you're welcome.

On Starve i use this simple version:

jQuery(document).on('ready page:change', function() { … })

Covers both events and allows the use of an anonymous function at the same time.
Also, from my understanding page:change is the earliest event to run javascript on the site (though we're talking about nanoseconds here ;) ).

Posted to jQuery initialization over 1 year ago

that last thing (let's call this closure an "anonymous scope") is totally valid given it is put in the right place. this construct is also considered best practice in javascript world to encapsulate your code from the global scope.

if you run it at the end of the page, you should not have any problems.
Also, the closure lacks an argument variable to hold the jquery reference you passed in (although it would work anyway :p).
You can even combine this with .noConflict() and use $ inside the closure at the same time:

(function($){
  // code
})(jQuery.noConflict())
Achievements
205 Karma
6,469 Total ProTip Views