Skip to content

Instantly share code, notes, and snippets.

View vanpelt's full-sized avatar
🤓
nerd

Chris Van Pelt (CVP) vanpelt

🤓
nerd
View GitHub Profile
rm #!/bin/sh
# clean up the previous installation so we can test it again.
echo
echo \# This script will attempt to remove all vestiges of a PostgreSQL8 installation
echo \# -----------------------------------------------------------------------------
echo \#
# make sure that we are running as root
x=`whoami | grep root`
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
body {
font:13px/1.231 "Helvetica Neue",arial,clean,sans-serif;
*font-size:small;
*font:x-small;
overflow:hidden;
{"_tainted"=>
[nil, true, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil],
"title"=>"",
"orig_gold_rel"=>
["3", "2", nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil],
"_ids"=>
[523581,
523675,
524097,
524476,
require 'httparty'
class CrowdFlower
include HTTParty
base_uri "https://crowdflower.com/jobs/"
def initialize(key = nil)
key ||= YOUR_KEY
self.class.default_params(:key => key)
end
require 'rubygems'
require 'httparty'
module HTTParty
class Request
def handle_response(response)
case response
when Net::HTTPRedirection
options[:limit] -= 1
#If override is set
def self.reject(jid, wid, max = nil)
q = Unit.all('judgments.job_id' => jid, 'judgments.worker_id' => wid, 'judgments.tainted' => false).to_a
job = Job.get(jid)
Judgment.all(:job_id => jid, :worker_id => wid).update!(:tainted => true)
q.each do |u|
AggregateJudgment.reset_unit(u.id)
u.rejudge!(job.judgments_per_unit)
end
worker = Worker.get(wid)
module Extension
def self.included(base)
base.extend ClassMethods
end
def rad
"rad"
end
module ClassMethods
require 'rubygems'
require 'httparty'
require 'cgi'
#Where u is an instance of Unit...
q = u.data["full_address_gold"].join(" ")
res = HTTParty.get("http://maps.google.com/maps/geo?q=#{CGI.escape(q)}&ue=utf8&sensor=false&key=ABQIAAAAo7WZCzZIkSblHMg0GJ-AwRTO9bHCf1xwbKWofRtvGHi3UueLXRRlU_wLzBzvBmEBRO_34kWbmaAngQ")
p = res["Placemark"]
if p && p.length == 1 && p[0]["AddressDetails"]["Accuracy"] > 6
u.data["full_address_gold"] = p[0]["address"]
require 'rubygems'
require 'httparty'
require 'cgi'
units = Unit.all(:job_id => 1111, :golden => true).to_a
units.each do |u|
#Where u is an instance of Unit...
q = u.data["full_address_gold"].join(" ")
res = HTTParty.get("http://maps.google.com/maps/geo?q=#{CGI.escape(q)}&ue=utf8&sensor=false&key=ABQIAAAAo7WZCzZIkSblHMg0GJ-AwRTO9bHCf1xwbKWofRtvGHi3UueLXRRlU_wLzBzvBmEBRO_34kWbmaAngQ")
p = res["Placemark"]
window.addEvent('domready', function(){
$$('.address')[0].getParent('form').addEvent('submit', function(e){
var bad = $$('.address').some(function(a){
if(a.retrieve('verified') != a.get('value')) {
return a.fireEvent('blur')
} else {
return false
}
})
if(bad)