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 get_gender_for_name(name) | |
| freq_female = female_data(name) || 0 | |
| freq_male = male_data(name) || 0 | |
| factor = 1 / (freq_female + freq_male) | |
| # 0.9 is our chosen level of significance | |
| if (freq_female * factor > 0.9) return "female" | |
| if (freq_male * factor > 0.9) return "male" | |
| return "unknown" |
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
| Index: Source/SPTablesList.m | |
| =================================================================== | |
| --- Source/SPTablesList.m (revision 3349) | |
| +++ Source/SPTablesList.m (working copy) | |
| @@ -1812,8 +1812,13 @@ | |
| for (i = 0; i < [tables count]; i++) { | |
| tableType = [[tableTypes objectAtIndex:i] integerValue]; | |
| if (tableType == SPTableTypeNone) continue; | |
| - substringRange = [[tables objectAtIndex:i] rangeOfString:[listFilterField stringValue] options:NSCaseInsensitiveSearch]; | |
| - if (substringRange.location == NSNotFound) continue; |
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
| post '/animal/:id' do | |
| @animal = Animal.get(params[:id]) | |
| @animal.name = params[:name] | |
| @aniaml.age = params[:age] | |
| @aniaml.color = params[:color] | |
| @animal.save | |
| redirect '/' | |
| 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
| require 'rubygems' | |
| require 'sinatra' | |
| get '/' do | |
| erb :index | |
| end | |
| post '/say_hello' do | |
| @name = params[:name] | |
| erb :form |
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 'sinatra' | |
| require 'dm-core' | |
| require 'dm-migrations' | |
| class Animal | |
| include DataMapper::Resource | |
| property :id, Serial | |
| property :name, String |
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 'sinatra' | |
| class Animal | |
| attr_accessor :name | |
| def initialize(name) | |
| @name = name | |
| end | |
| def about | |
| "#{@name} is urrrrrr?" |
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 'sinatra' | |
| get '/' do | |
| erb :index | |
| end | |
| post '/say_hello' do | |
| @name = params[:name] | |
| erb :form |
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 'sinatra' | |
| get '/say_hello/:name' do | |
| @name = params[:name] | |
| erb :say_hello | |
| end | |
| __END__ | |
| @@ say_hello |
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 'sinatra' | |
| get '/say_hello/:name' do | |
| "Hello #{params[:name]}" | |
| 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
| require 'rubygems' | |
| require 'sinatra' | |
| get '/' do | |
| "Hello, World!" | |
| end |
NewerOlder