Do You Speak PHP?

<?
if ($craigslist->user->checkSkills(array('php','mysql','html','js'))) {

/**
 * Handle applications for a PHP/MySQL/HTML/JS/etc. position
 * intended for entry-level to mid-level to advanced PHP
 * coders.
 *
 * @author Ben Cabell, echo('q'.(5*20*20+7).'@'.(false ? 'dogs' : 'besiex').'.org');
 */

// Initialize the libraries, classes, and common objects we need
// access to.
require_once(dirname(__FILE__)."/craigslist/setup.php");

// $craigslist is now defined, and gives us access to things
// such as $craigslist->user, which holds the user's data.

// Define the importance of each skill
define('SKILL_IMPORTANCE_BONUS',6);
define('SKILL_IMPORTANCE_HIGH',5);
define('SKILL_IMPORTANCE_MEDIUM',3);
define('SKILL_IMPORTANCE_LOW',1);

// Define the limits of scoring
define('APPLICANT_HIGH_SCORE',45);
define('APPLICANT_OK_SCORE',30);

 // Define the maximum rate we can afford, still
 // depending on skills/experience/location
define('APPLICANT_SALARY_LIMIT',40);

// Define the minimum years of experience necessary per skill
$skillAndExperienceRequirements = array(
        // skill_name=>array(years_of_experience, importance_of_skill)
        "PHP"=>array(2,SKILL_IMPORTANCE_HIGH),                    // MUST KNOW PHP VERY WELL!
        "MySQL"=>array(2,SKILL_IMPORTANCE_HIGH),                  // MUST KNOW MySQL VERY WELL!
        "HTML"=>array(3,SKILL_IMPORTANCE_HIGH),                   // MUST KNOW HTML VERY WELL!
        "JavaScript"=>array(1.5,SKILL_IMPORTANCE_HIGH),           // MUST KNOW JS WELL!
        "UNIX"=>array(1,SKILL_IMPORTANCE_HIGH),                   // MUST BE FAMILIAR WITH UNIX
        "DHTML"=>array(1,SKILL_IMPORTANCE_HIGH),                  // SHOULD KNOW SOME DHTML
        "AJAX"=>array(0,SKILL_IMPORTANCE_MEDIUM),                 // MUST KNOW WHAT AJAX IS AND BE PREPARED TO USE IT
        "SVN"=>array(0.5,SKILL_IMPORTANCE_MEDIUM),                // MUST KNOW CVS OR SUBVERSION FOR VERSION CONTROL
        "XML"=>array(1,SKILL_IMPORTANCE_MEDIUM),                  // MUST BE READY TO USE XML
        "ZendStudio"=>array(0,SKILL_IMPORTANCE_LOW),              // optional, but useful...
        "vBulletin"=>array(0,SKILL_IMPORTANCE_BONUS)             // experience customizing the software, not just installing/using
    );

/*
Check the user to see if they match our requirements!
*/

// People applying MUST be individuals, they can't be part of a programming/development companies.
if (!$craigslist->user->isIndependent()) {
    turnDownApplicant ($craigslist->user, "We are only looking for
individuals, not for programming/development companies.");
}

// Check the applicant's hourly rate.
if ($craigslist->user->hourlyRate > APPLICANT_SALARY_LIMIT) {
    turnDownApplicant ($craigslist->user, "Unfortunately, our budget
is tight and we're unable to meet your salary demands.

We are a startup and we can't afford to pay more at this time.

We're thinking this position might be a good opportunity/position
for someone with more skills than experience, who is looking to
prove his skills and add to his resume.

This job isn't for everyone, to be sure, but it is an excellent
and mutually beneficial opportunity for some few, and you know
better than us who you are.");
}

// Calculate the applicant's score...
$applicantReviewData = calculateSkillAndExperienceScore($craigslist->user,
        $skillAndExperienceRequirements);
$applicantScore = $applicantReviewData['score'];
$applicantSummary = $applicantReviewData['message'];

// Check the applicant's location...
if (!$craigslist->user->location->isNear("US","90291","CA","Venice",45 /* miles */)) {
    // If you're not near us you've either got to be:
    // a) cheap (& good)
    // b) incredibly good
    if (!($applicantScore >= APPLICANT_HIGH_SCORE ||   // Highly skilled applicant
        $craigslist->user->hourlyRate <= 20)) {      // $20/hr
        turnDownApplicant ($craigslist->user, "You are located pretty far
away from us and your skills/experience and/or hourly
rate are not such that we can overlook the distance.");
    }
}

// Did the applicant score high enough?
if ($applicantScore < APPLICANT_OK_SCORE) {
    turnDownApplicant ($craigslist->user, "Your skills/experience
aren't quite what we need.");
}

// Notify us, this applicant sounds good!
$craigslist->notify(EMPLOYER_EMAIL, $craigslist->user, $applicantScore, $applicantSummary);

// Tell the applicant that we think they might be a match!
print <<< EOT
Thanks for reading our job posting! You
appear to have the right skills, experience, and
very likely attitude (if you've made it this
far).

We are looking for one or two PHP coders to
help us with a new startup company in the survey
arena.

We're looking for very special coders
motivated by curiosity more than cash, and who
view coding as an art not merely a science.
We're looking for that rare < 1% of you with whom
there would be a special synergistic something
where we are all enriched, you as much as we.

You would be able to work offsite (from home)
much of the time, except where projects
demanded more interactivity. You would also
need to attend weekly meetings, etc.

Please relate any dhtml, ajax, json, user-driven
content (web 2.0), etc. experience
you may have since that will increase your
effectiveness in relating to our users and
developing better web applications.

And in case you are wondering who we are, since
startups can be worryingly unstable things,
we are the management & owners of several
successful web sites which reach an audience of
tens of millions of unique users a month.  This
new company builds off that success (and that
traffic) and will enhance our existing properties
and move us into new areas.

If you think you might be a good match for us,
and us for you, e-mail us and tell us more about
yourself, and include salary requirements.

P.S. - If you want us to notice you, tell us something
about yourself that makes you special, that defines you.
EOT;

/**
 * Analyze the user against the skill/experience
 * requirements and calculate a score and a list
 * of which criteria they meet.
 */

function calculateSkillAndExperienceScore ($user, $skillsAndExperienceRequirements) {
    $score = 0;
    $message = "";

    foreach ($skillsAndExperienceRequirements as $skillAndExperienceRequirementName=>$skillAndExperienceRequirementData) {
        list($yearsOfExperience,$importanceOfSkill) = $skillAndExperienceRequirementData;
        $highlight = "";

        $userExperience = $user->getExperience($skillAndExperienceRequirementName);

        if ($userExperience >= $yearsOfExperience) {
            $score += $importanceOfSkill;
            $minimumMetMessage = "X";
        } else {
            $minimumMetMessage = " ";
        }

        if ($importanceOfSkill == SKILL_IMPORTANCE_BONUS) {
            $highlight = "***";
        } elseif ($importanceOfSkill == SKILL_IMPORTANCE_HIGH) {
            $highlight = "*";
        }

        $message .= <<< EOT
[{$minimumMetMessage}] {$skillAndExperienceRequirementName}: {$userExperience} {$highlight}\n
EOT;
    }

    return array('message'=>$message,'score'=>$score);
}

/**
 * Tell the applicant that unfortunately they aren't
 * what we are looking for.
 */

function turnDownApplicant ($user, $customMessage) {
    print <<< EOT
Dear {$user->name},

{$customMessage}

I'm sorry, but we don't feel that you'd be the right person
for us at this time.  We're a small company and our budget
is limited, and requires us to be more selective than we
might otherwise be.  We wish you all the best in your job
search, we know it's often a difficult and emotional time;
we've all been there.

EOT;

    die();
}

} // end the title brace :)
?>
 


We take certain playful liberties with the foundational and cultural history of our company. But on technical matters, we tell no tales.