This file contains 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
Have you read the "pickaxe" book? | |
Yes | |
No | |
Have you read the "agile" rails book? | |
Yes | |
No | |
This file contains 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 self.query(query) | |
if @parser.nil? | |
@parser = Searcher::Parser.new | |
@parser.lookup(:academic_field, "academic_fields.name") | |
@parser.lookup(:sat_1600, "(sat_1600_math_score + sat_1600_verbal_score)") | |
@parser.lookup(:sat_2400, "(sat_2400_math_score + sat_2400_critical_reading_score + sat_2400_writing_score)") | |
@parser.lookup(:act, "(act_english_score + act_math_score + act_reading_score + act_science_reasoning_score)") | |
@parser.lookup(:job_type, "job_types.name") | |
@parser.lookup(:field_of_interest, "field_of_interests.name") | |
@parser.lookup(:location) do |value| |
This file contains 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
@parser.lookup(:location) do |name, operator, value| | |
location = PreferredLocation.find_by_name(value) | |
if operator == "name" | |
tolerance = 1 | |
else | |
tolerance = 0 | |
end | |
["((preferred_locations.lat between ? and ?) AND (preferred_locations.lon between ? and ?))", location.lat - tolerance, location.lat + tolerance, location.lon - tolerance, location.lon + tolerance] | |
end | |
end |
This file contains 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
if field.is_a? String | |
# Create a criteria parser | |
line, formatted_value = Searcher::Criteria.new(field, operator, value).matcher | |
formatted_values = [formatted_value] | |
elsif field.is_a? Proc | |
line, *formatted_values = field.call(*[value, operator, field][0...field.arity]) | |
end |
This file contains 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
# Controller | |
def set_content_type | |
content_type = guess_content_type | |
Merb.logger.debug "Setting content type as " + content_type.to_s | |
end | |
def guess_content_type | |
ua = request.user_agent | |
if ua.include? "WebKit" |
This file contains 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
en: | |
main_page: "Main_Page" | |
selectors: | |
article_of_the_day: "#mp-tfa" | |
news_items: "#mp-itn" | |
de: | |
main_page: "Wikipedia:Hauptseite" | |
selectors: | |
article_of_the_day: "#hauptseite-artikel .inhalt" | |
news_items: "#hauptseite-nachrichten .inhalt" |
This file contains 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 guess_content_type | |
ua = request.user_agent | |
if ua.include? "WebKit" | |
if ua.include?("iPhone") && !ua.include?("Safari") | |
:webkit_native | |
else | |
:webkit | |
end | |
else | |
:html |
This file contains 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 'open-uri' | |
open("http://en.wikipedia.org/wiki/Labe").read | |
open("http://en.wikipedia.org/wiki/USA").read |
This file contains 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
class FieldBuilder < ActionView::Helpers::FormBuilder | |
# Don't use check_box until it's modified to handle an un-check of a previous saved checked value... unchecked boxes | |
# are not passed in params[]. | |
# | |
#def check_box(name, options = {}) | |
# field name, options.merge({:class => 'checkbox'}) do |field_name, this_field, field_attributes, enabled| | |
# @template.check_box_tag(field_name, true, (!(this_field.value.nil? || this_field.value.empty?) || options[:default_value]), field_attributes) #, :disabled => (!enabled).to_s) | |
# end | |
#end | |
This file contains 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
# SQLite version 3.x | |
# gem install sqlite3-ruby (not necessary on OS X Leopard) | |
development: | |
adapter: sqlite3 | |
database: db/development.sqlite3 | |
timeout: 5000 | |
# Warning: The database defined as "test" will be erased and | |
# re-generated from your development database when you run "rake". | |
# Do not set this db to the same as development or production. |
OlderNewer