This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def point_in_polygon?(polygonPoints) | |
| return false if self.latitude.blank? or self.longitude.blank? | |
| polygonPoints.each do |point| | |
| point[0] = point[0].to_f | |
| point[1] = point[1].to_f | |
| end | |
| contains_point = false | |
| i = -1 | |
| j = polygonPoints.size - 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # WAIT! Do consider that `wait` may not be needed. This article describes | |
| # that reasoning. Please read it and make informed decisions. | |
| # https://www.varvet.com/blog/why-wait_until-was-removed-from-capybara/ | |
| # Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations? | |
| describe 'Modal' do | |
| should 'display login errors' do | |
| visit root_path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // I thought I needed it, but I didn't need it anymore, | |
| // but I already implemented it. So, here we go, if you | |
| // ever would need a Javascript camelize implementation | |
| // you can freely use this :-). | |
| // - vjt@openssl.it Tue Feb 15 16:49:52 CET 2011 | |
| jQuery.extend (String.prototype, { | |
| camelize: function () { | |
| return this.replace (/(?:^|[-_])(\w)/g, function (_, c) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #require 'rubygems' | |
| require 'pp' | |
| #require 'ap' # Awesome Print | |
| class Object | |
| # expects [ [ symbol, *args ], ... ] | |
| def recursive_send(*args) | |
| args.inject(self) { |obj, m| obj.send(m.shift, *m) } | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # cat, dog = Cat.new, Dog.new | |
| # cat.friends << dog | |
| # cat.save | |
| # => false | |
| # cat.errors | |
| # #<ActiveRecord::Errors ... @errors={"dog" => "is not valid"}> | |
| # cat.errors << dog.errors | |
| # cat.errors | |
| # #<ActiveRecord::Errors ... @errors={"dog" => "is not valid", "bark" => "is not bigger than bite"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Someone recently asked the following question in the discussion forum of the Rubyists LinkedIn group: What separates a junior Rails developer from a senior one? | |
| My response follows. Join us at http://www.linkedin.com/groups?gid=120725 to weigh in on this and other topics of interest to Rubyists. As of today there are almost 1,200 members, including numerous movers and shakers in the Ruby and Rails communities. | |
| “Distinguishing between junior and senior people in the Rails world is not so different from making the distinction in other web development environments. | |
| “Junior Rails people have not dealt with scaling issues to the degree that senior people have. Getting a public-facing Rails application to perform under significant stress is more challenging than doing the same with other building materials such as PHP. Senior people know how to performance-test Rails applications, where to look for bottlenecks, and how to eliminate them one after another until performance is acceptable in real conditions. The Ra |
NewerOlder