Skip to content

Instantly share code, notes, and snippets.

@tristar500
tristar500 / gist:2989005
Created June 25, 2012 14:32
CI Form Validation
//Check that the form was submitted
if ($this->input->post())
{
$this->load->library('form_validation');
//set rules...
$this->form_validation->set_rules('EID','EID','required');
//etc...
if ($this->form_validation->run() === FALSE)
@tristar500
tristar500 / gist:2819863
Created May 28, 2012 16:05
jQuery to make all column divs within a containing 'group' div the same height
/* Make all column div within 'group' the same height */
/* http://www.cssnewbie.com/equal-height-columns-with-jquery/ */
function equalHeight(group) {
var tallest = 0;
group.each(function() {
var thisHeight = $(this).height();
if(thisHeight > tallest) {
tallest = thisHeight;
}
});
@tristar500
tristar500 / gist:2732168
Created May 19, 2012 19:47
Create 6 char uniquie ID
private function generateUniqueID()
{
// creates a unique 6 position alphanumeric client id
// if the client id is already in the clients table then call this function again
// otherwise return the client id
//
$newCode = strtoupper(substr(md5(uniqid(rand(), true)),0,6)); // creates a 6 digit token
if($this->job_model->isIDinUse($newCode)){
// that code exists already so try again
@tristar500
tristar500 / state_menu_helper.php
Created March 18, 2012 19:49
State Menu Helper
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
if ( ! function_exists('getStateMenu'))
{
function getStateMenu($CI, $id = "", $name = "", $class = "", $tab = 0)
{
// $CI - if true returns the array of state names to use with the CI form helper
// if $CI is false returns an HTML form select object
// $id for the select
<?php
/**
* Return the return the word with inital caps
*
* @access public
* @param string the word
* @return string
*/
if(!function_exists('pdf_file_name'))
@tristar500
tristar500 / logs_helper.php
Created March 18, 2012 19:47
Log File Helper
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// --------------------------------------------------------------------
if ( ! function_exists('log_entry'))
{
// adds the $message to $the_log
function log_entry($the_log, $message)
{
$myPath = $_SERVER['DOCUMENT_ROOT'].'/system/logs/';
@tristar500
tristar500 / debug_helper
Created March 18, 2012 19:45
Debug Helper
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// --------------------------------------------------------------------
if(!function_exists('vardump'))
{
function vardump($text='',$theVar)
{
echo '<pre>';
echo $text . ': ';
var_dump($theVar);
@tristar500
tristar500 / gist:1879236
Created February 21, 2012 21:52
Vertical jQuery Text Scroller
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>vTicker</title>
<meta name="description" content=" " />
<meta name="keywords" content=" " />
<style type="text/css" media="all">
@tristar500
tristar500 / gist:1469137
Created December 12, 2011 21:15
PHP good to know stuff
http://net.tutsplus.com/tutorials/php/9-useful-php-functions-and-features-you-need-to-know/
@tristar500
tristar500 / gist:1445915
Created December 8, 2011 02:55
paypal returned data
$saveArray = array(
'mc_gross' => $_POST['mc_gross'],
'protection_eligibility' => $_POST['protection_eligibility'],
'address_status' => $_POST['address_status'],
'payer_id' => $_POST['payer_id'],
'tax' => $_POST['tax'],
'address_street' => $_POST['address_street'],
'payment_date' => $_POST['payment_date'],
'payment_status' => $_POST['payment_status'],
'charset' => $_POST['charset'],