eXorithm – Execute Algorithm: Embed Algorithm address_elevation


Embed This Algorithm

This page will help you embed the algorithm address_elevation on a page on your own website. Just configure the inputs, then click the generate button to get a snippet of code you can paste onto your site. You have two options.

  1. You can embed the entire form. Users will be able to enter their own arguments, and will need to press the run button to execute the algorithm.
  2. You can add only the output of the algorithm to your website. There will be no argument inputs or run button.
address Argument info
Embed the form Embed only the output

eXorithm – Execute Algorithm: View / Run Algorithm google_translate

function google_translate ($text$from$to
{
  $transfile_get_contents"http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q="urlencode$text)."&langpair="urlencode$from)."|"urlencode$to));
  $json = json_decode$trans);
  
  if (!isset$json->responseStatus) || ($json->responseStatus!=200)) {
    throw new Exception"Translation could not be retreived for '$text'");
  }
  
  return $json->responseData->translatedText;

eXorithm – Execute Algorithm: View / Run Algorithm image_callback

function image_callback ($image$operation
{
  /* perform a series of transformation on an image */
  
  switch ($operation) {
    case "flip"
      $image = flip_image$image"vertical");
      break
    case "skew"
      $image = skew_image$image, 0.5);
      break
    case "invert"
      $image = invert_image$image);
      break
  }
  
  $ret = array();
  $ret"return"] = $image
  $ret"handler"] = HANDLER_IMAGE;
  $ret"arguments"] = array$image);
  return $ret

eXorithm – Execute Algorithm: View / Run Algorithm stock_ticker

function stock_ticker ($symbols$background_color$stock_color$price_color$up_color$down_color$speed
{
  sort$symbols);
  
  if ($background_color==$stock_color) {
    // something's wrong, colors weren't specified
    $background_color = invert_color$background_color);
  }
  
  $return = '<div align="center">
  <marquee bgcolor="#'$background_color'" loop="20" scrollamount="'$speed'">'
  
  foreach ($symbols as $symbol) {
    $data = file_get_contents"http://quote.yahoo.com/d/quotes.csv?s=$symbol&f=sl1d1t1c1ohgv&e=.csv");
    
    $values = explode","$data);
    $lasttrade = $values[1];
    $change = $values[4];
    
    $return .= "<span style="color:#$stock_color">$symbol</span> &nbsp;"
    $return .= "<span style="color:#$price_color">$lasttrade</span> &nbsp;"
    if ($change<0)
      $return .= "<span style="color:#$down_color">$change</span> &nbsp;"
    else
      $return .= "<span style="color:#$up_color">$change</span> &nbsp;"
    $return .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
  }
  
  $return .= '</marque>
  </div>'
  
  return $return

eXorithm – Execute Algorithm: View / Run Algorithm isbn_validate

function isbn_validate ($isbn$type
{
  $okay = false;
  $isbn = str_replacearray'-'' '), ''$isbn);
  
  // check ISBN 13
  if ($type!=2)
  {
    if (strlen$isbn)==13)
    {
      $sum=0;
      $charsokay=true;
      for ($i=0;$i<12;$i++)
      {
        if (($i%2)==1)
          $weight=3;
        else
          $weight=1;
        
        if (is_numeric$isbn$i]))
          $sum += $weight$isbn$i];
        else
          $charsokay=false;
      }
     
      if ($charsokay
        if ($sum>0)
          if ((10-($sum % 10)) % 10==$isbn[12])
            $okay = true;
    }
  }
  
  // check ISBN 10
  if ($type!=1)
  {
    if (strlen$isbn)==10)
    {
      $sum=0;
      $charsokay=true;
      for ($i=0;$i<10;$i++)
      {
        if (is_numeric$isbn$i]))
          $sum += ($i+1)*$isbn$i];
        else 
        {
          if ((strtolower$isbn$i])=='x') && ($i==9))
            $sum += 100;
          else
            $charsokay=false;
        }
      }
         
      if ($charsokay
        if ($sum>0)
          if (($sum % 11)==0)
            $okay = true;
    }
  }
  
  return $okay

eXorithm – Execute Algorithm: Embed Algorithm magic8ball


Embed This Algorithm

This page will help you embed the algorithm magic8ball on a page on your own website. Just configure the inputs, then click the generate button to get a snippet of code you can paste onto your site. You have two options.

  1. You can embed the entire form. Users will be able to enter their own arguments, and will need to press the run button to execute the algorithm.
  2. You can add only the output of the algorithm to your website. There will be no argument inputs or run button.
Embed the form Embed only the output

eXorithm – Execute Algorithm: Embed Algorithm duotone_image


Embed This Algorithm

This page will help you embed the algorithm duotone_image on a page on your own website. Just configure the inputs, then click the generate button to get a snippet of code you can paste onto your site. You have two options.

  1. You can embed the entire form. Users will be able to enter their own arguments, and will need to press the run button to execute the algorithm.
  2. You can add only the output of the algorithm to your website. There will be no argument inputs or run button.

image Argument info
rplus Argument info
gplus Argument info
bplus Argument info
pcnt Argument info
Embed the form Embed only the output

eXorithm – Execute Algorithm: View / Run Algorithm antialias_pixel

function antialias_pixel ($image$x$y$color$weight
{
  $c = imagecolorsforindex$image$color);
  $r1 = $c'red'];
  $g1 = $c'green'];
  $b1 = $c'blue'];
  $t1 = $c'alpha'];
  
  $color2 = imagecolorat$image$x$y);
  $c = imagecolorsforindex$image$color2);
  $r2 = $c'red'];
  $g2 = $c'green'];
  $b2 = $c'blue'];
  $t2 = $c'alpha'];
  
  $cweight = $weight+($t1/127)*(1-$weight)-($t2/127)*(1-$weight);
  
  $r = round$r2$cweight + $r1*(1-$cweight));
  $g = round$g2$cweight + $g1*(1-$cweight));
  $b = round$b2$cweight + $b1*(1-$cweight));
  
  $t = round$t2$weight + $t1*(1-$weight));
  
  return imagecolorallocatealpha$image$r$g$b$t);