Skip to content

Instantly share code, notes, and snippets.

View manishdas's full-sized avatar

Manish Das manishdas

View GitHub Profile
@manishdas
manishdas / gist:1245369
Created September 27, 2011 15:26
gem list --local
*** LOCAL GEMS ***
actionmailer (3.1.0)
actionpack (3.1.0)
activemodel (3.1.0)
activerecord (3.1.0)
activeresource (3.1.0)
activesupport (3.1.0)
arel (2.2.1)
bcrypt-ruby (3.0.1)
@manishdas
manishdas / gist:1245363
Created September 27, 2011 15:24
rvm info
system:
system:
uname: "Linux manish 2.6.35-30-generic #59-Ubuntu SMP Tue Aug 30 15:58:00 UTC 2011 i686 GNU/Linux"
bash: "/bin/bash => GNU bash, version 4.1.5(1)-release (i686-pc-linux-gnu)"
zsh: "/usr/bin/zsh => zsh 4.3.10 (i686-pc-linux-gnu)"
rvm:
version: "rvm 1.8.4 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]"
@manishdas
manishdas / contact.rb
Created September 15, 2011 19:10 — forked from the-architect/contact.rb
Automatically create scopes for all available state_machine states in Rails 3.1
class Contact < ActiveRecord::Base
state_machine :state, :initial => :imported do
state :imported
state :contacted
state :verified
state :prospect
state :deleted
end
Company, Website
Sprout, http://www.sprout-technology.com/
Apple, http://www.apple.com/
run = CF::Run.create("Bizzcardarmy", "run_name", path_of_your_file)
run = CF::Run.create("Bizzcardarmy", "run_title", [{"Company" => "Sprout", "Website" => "http://www.sprout-technology.com/"}, {"Company" => "Apple", "Website" => "http://www.apple.com/"}])
line = CF::Line.create("Bizzcardarmy","Digitization") do |l|
# creation of initial input_formats for line with (Company, Website)
CF::InputFormat.new({:line => l, :name => "Company", :required => true})
CF::InputFormat.new({:line => l, :name => "Website", :required => true, :valid_type => "url"})
# creation of first station with input_format Company and without Website
CF::Station.create({:line => l, :type => "work"}) do |s|
CF::HumanWorker.new({:station => s, :number => 1, :reward => 20})
CF::TaskForm.create({:station => s, :title => "Enter the name of CEO", :instruction => "Describe"}) do |i|
CF::FormField.new({:form => i, :label => "First Name", :field_type => "short_answer", :required => "true"})
CF::FormField.new({:form => i, :label => "Middle Name", :field_type => "short_answer"})
line = CF::Line.create("Bizzcardarmy","Digitization") do |l|
# creation of initial input_formats for line with (Company, Website)
CF::InputFormat.new({:line => l, :name => "Company", :required => true})
CF::InputFormat.new({:line => l, :name => "Website", :required => true, :valid_type => "url"})
# creation of first station with input_format Company and without Website
CF::Station.create({:line => l, :type => "work", :input_formats=> {:station_0 => [{:name => "Company"},{:name => "Website", :except => true}]}}) do |s|
CF::HumanWorker.new({:station => s, :number => 1, :reward => 20})
CF::TaskForm.create({:station => s, :title => "Enter the name of CEO", :instruction => "Describe"}) do |i|
CF::FormField.new({:form => i, :label => "First Name", :field_type => "short_answer", :required => "true"})
CF::FormField.new({:form => i, :label => "Middle Name", :field_type => "short_answer"})
line = CF::Line.create("bizzcard_army","Digitization") do |l|
# Creating a new InputFormat
CF::InputFormat.new({:line => l, :field_type => "text_data", :required => true, :valid_type => "url"})
# Creating a new Station
CF::Station.create({:line => l, :type => "work"}) do |s|
# Creating a new HumanWorker
CF::HumanWorker.new({:station => s, :number => 1, :reward => 20})
# Creating A new CustomTaskForm
CF::CustomForm.create({:station => station, :title => "Enter text from a business card image", :instruction => "Write Your Description for the worker here", :raw_html => "html_content", :raw_css => "css_content", :raw_javascript => "javascript_content"})
end
line = CF::Line.new("bizzcard_army", "Digitization")
station = CF::Station.new({:type => "work"})
line.stations station
input_format_1 = CF::InputFormat.new({:label => "Company",:field_type => "text_data",:value => "Google", :required => true, :validation_format => "general"})
input_format_2 = CF::InputFormat.new({:label => "Website",:field_type => "text_data",:value => "www.google.com", :required => true, :validation_format => "url"})
line.stations.first.input_formats input_format_1
line.stations.first.input_formats input_format_2