This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class JtAwesomeHelpers | |
{ | |
public static function SimpleMailer($subject = 'DW Operation Complete', $body='', $htmlbody = '', $to = '[email protected]') { | |
$headers = 'MIME-Version: 1.0' . "\r\n"; | |
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n" . | |
'From: Your Mailer <[email protected]>' . "\r\n" . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<title>Javascript Object Sorting Exercise</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | |
<style type="text/css"> | |
.yella { | |
background-color: yellow; | |
} | |
.arrow-up { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class HelperLibrary { | |
// Utility to slice an associative array | |
public static function assoc_array_slice($array, $offset, $count) { | |
$result = array(); | |
$keys = array_keys($array); | |
$end = min($offset + $count, count($array)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class HelperLibrary | |
{ | |
/** | |
* Sort an associative array of objects by any number of properties in any order, maintaining key association. | |
* | |
* Example usage, for an array of users: | |
* | |
* $users = array(); | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Displays details of GD support on your server */ | |
echo '<div style="margin: 10px;">'; | |
echo '<p style="color: #444444; font-size: 130%;">GD is '; | |
if (function_exists("gd_info")) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Based on SIMPLE CAPTCHA IMAGE SCRIPT by Constantin Boiangiu | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JtXmlParser | |
{ | |
const XML_PATH ='datasource.xml'; | |
const START_NODE = 'ROW'; // the element identifying a new record | |
public $file, | |
$rows = array(), | |
$record = array(), | |
$fdata = '', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DrupalFormBuilder implements ArrayAccess | |
{ | |
private $data = array(); | |
public function __construct(array $fieldsets = array('fs1'=>'fs1')) { | |
foreach($fieldsets as $key=>$fieldset){ | |
$this->addFieldset($fieldset); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* A general purpose password hashing routine (from Drupal) | |
* | |
* Requires two standard drupal "include" files (available for download at https://www.drupal.org/): | |
* 1. drupal_bootstrap.inc | |
* 2. drupal_password.inc | |
* | |
* You might also want to use it to manually "reset" a password in a Drupal site's "user" MySQL table | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* A set of generic data structures for extending the Drupal 7 Database class. | |
* | |
* For non-Drupal projects, you could also use this with PDO. | |
* | |
* Just re-write the BaseObject, BaseEntity, BaseCollection classes. | |
* | |
* | |
* Defining your own data types in PHP is as easy as: |