Skip to content

Instantly share code, notes, and snippets.

View ccagle8's full-sized avatar

Chris Cagle ccagle8

View GitHub Profile
@ccagle8
ccagle8 / hexToKmlColor.php
Last active April 4, 2022 11:26
PHP Function - Transform hex color to KML format. Used on https://cartographyvectors.com
/*
# KML files use a combined hexadecimal value in place of the normal HTML rgba value.
# The format is described in detail here: https://developers.google.com/kml/documentation/kmlreference#elements-specific-to-balloonstyle
#
# Syntax Example:
# $kmlColor = hexToKmlColor('#CC0000', 40); // returns `6600CC00`
#
# This function can handle all formats of hex values: with or without the hash, shorthand or long.
# It also handles opacity values either in percentage or decimal form.
#
@ccagle8
ccagle8 / fake-data.js
Last active October 5, 2015 18:17
f r a u d
var ids=new Array(
"0221aa6ed078460bae033dbd00e2eb83&email=toseptember&ip=110.118.55",
"0221aa6ed078460bae033dbd00e2eb83&email=toseptember&ip=37.184.212",
"0221aa6ed078460bae033dbd00e2eb83&email=toseptember&ip=203.53.228",
"0221aa6ed078460bae033dbd00e2eb83&email=toseptember&ip=124.186.30",
"0221aa6ed078460bae033dbd00e2eb83&email=toseptember&ip=116.250.78",
"0221aa6ed078460bae033dbd00e2eb83&email=toseptember&ip=140.0.141",
"0221aa6ed078460bae033dbd00e2eb83&email=toseptember&ip=27.151.126",
"0221aa6ed078460bae033dbd00e2eb83&email=toseptember&ip=182.160.172",
"0221aa6ed078460bae033dbd00e2eb83&email=toseptember&ip=216.155.217",
@ccagle8
ccagle8 / us-dma-markers.js
Last active August 29, 2015 14:14
DMA Markers for jVectorMap
/*
via @ccagle8
https://gist.github.com/ccagle8/7375be0cf66eec533981
*/
var dmaData = {
dma662: {latLng: [32.404348, -99.8293625], dma: 662, name: "Abilene-Sweetwater, TX", stat: 0 },
dma525: {latLng: [31.5279975, -83.7121235], dma: 525, name: "Albany, GA", stat: 0 },
dma532: {latLng: [43.049266, -73.8438695], dma: 532, name: "Albany-Schenectady-Troy, NY", stat: 0 },
dma790: {latLng: [34.4952755, -106.526644], dma: 790, name: "Albuquerque-Santa Fe, NM", stat: 0 },
dma644: {latLng: [31.322628, -92.61795], dma: 644, name: "Alexandria, LA", stat: 0 },
@ccagle8
ccagle8 / php-xml-utilities.php
Created July 11, 2013 02:01
Essential XML utilities in PHP.
<?php
/**
* SimpleXMLExtended Class
*
* Extends the default PHP SimpleXMLElement class by
* allowing the addition of cdata
*
* @param string $cdata_text
*/
@ccagle8
ccagle8 / display-alert-msg-bootstrap.php
Last active December 19, 2015 14:48
A simple way to display Twitter Bootstrap messages dynamically with PHP.
<?php
/**
* Display Alert Messages
*
* Looks for a global variable, and displays any test that variable has
*
* @uses GLOBALS $notice, $error, $success, $infonotice, $alertBlock
* @return string
*/
function display_messages() {
@ccagle8
ccagle8 / php-states-dropdown.php
Created July 11, 2013 01:48
PHP generated United States Dropdown
<?php
/**
* States Dropdown
*
* Required the use of the SQL provided
*
* @uses check_select
* @param string $post, the one to make "selected"
* @param string $type, by default it shows abbreviations.
@ccagle8
ccagle8 / sendmail-simple-html-template.php
Last active December 19, 2015 14:49
Simple HTML email formatting with sendmail.
<?php
function sendmail($to,$subject,$message,$from='no-reply@example.com', $format = true) {
if($format) {
$message = email_template($message);
}
$headers = "From: ".$from . PHP_EOL;
$headers .= "Reply-To: ".$from . PHP_EOL;