Skip to content

Instantly share code, notes, and snippets.

View rajraj's full-sized avatar

Rajesh Rajappan rajraj

View GitHub Profile
@rajraj
rajraj / rapleaf.rake
Created March 17, 2011 22:45
Rapleaf Name to Gender API
namespace :ycpages do
desc "Update person gender using RapLeaf's name to gender API."
task :update_gender => :environment do
Person.all.each do |person|
unless person.gender.present?
url = "http://api.rapleaf.com/v4/util/name_to_gender/#{person.name.split.first}"
response = Net::HTTP.get_response(URI.parse(url))
result = JSON.parse(response.body)
if ((result["status"] == "OK") && (result["answer"]["likelihood"].to_f > 0.9))
person.update_attribute(:gender, result["answer"]["gender"])
echo off
REM cd into your rails app folder
cd e:\webapps\projects
REM Then Call the rake task
call rake trant:send_notification
namespace :trant do
desc "Send email notifications for a project."
task :send_notification => :environment do
Project.send_notification
end
end
/*
=skin=
@name Simpliquity
@author Yatrik Solanki
@homepage http://www.yatriksolanki.com
@email yatriksolanki@gmail.com
@license MPL/LGPL/GPL