Skip to content

Instantly share code, notes, and snippets.

View rzfarrell's full-sized avatar

Ryan Farrell rzfarrell

View GitHub Profile
<?php
function isColorful($number)
{
$number_as_string = strval($number);
$hash = array();
$number_as_array = str_split($number);
foreach ($number_as_array as $int)
{
if (isset($hash[strval($int)])) return false;
@rzfarrell
rzfarrell / addresses.php
Last active October 13, 2020 11:59
list of a McDonald's address in all 50 states plus DC. Used for various function checks requiring address calculations. (Tax/Freight/Etc)
$addresses = array( 'AL' => '580 Cahaba Valley Rd,Pelham,AL,35124,US',
'AK' => '2601 E Tudor Rd,Anchorage,AK,99503,US',
'AZ' => '1635 E Camelback Rd,Phoenix,AZ,85016,US',
'AR' => '11500 W Markham St Rd,Little Rock,AR,72211,US',
'CA' => '801 E Cypress Ave,Redding,CA,96002,US',
'CO' => '8120 Voyager Pkwy,Colorado Springs,CO,80920,US',
'CT' => '783 E Main St,Meriden,CT,06450,US',
'DE' => '16758 S Dupont Hwy,Harrington,DE,19952,US',
'DC' => '2481-83 18th St NW,Washington,DC,20009,US',
'FL' => '2510 US Hwy 231,Cottondale,FL,32431,US',
@rzfarrell
rzfarrell / image_test.php
Created July 13, 2017 12:44
Translate 3D object onto 2D space
<?php
function RotatePoint($sin,$cos,$x,$y) {
return array($x*$cos - $y*$sin, $y*$cos + $x*$sin);
}
function draw_boxes($image_name, $image_size, $boxes)
{
$image = imagecreatetruecolor($image_size, $image_size);
imageantialias($image, true);
$white = imagecolorallocate($image, 255, 255, 255);
@rzfarrell
rzfarrell / salesforce outbound message listener
Created April 16, 2015 20:36
php salesource outbound message listener
<?php
header("Content-Type: text/xml\r\n");
ob_start();
// Sends SOAP response to SFDC
function respond($tf) {
print '<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<notifications xmlns="http://soap.sforce.com/2005/09/outbound">