Skip to content

Instantly share code, notes, and snippets.

View travisfont's full-sized avatar
🍇
// = Earthberries !!

Travis van der F. travisfont

🍇
// = Earthberries !!
View GitHub Profile
@travisfont
travisfont / migrations_eg.php
Last active December 30, 2015 07:29
Generates some SQL structure code using PHP objects
<?php
class create_table
{
private $query;
private $increments = array(NULL, NULL, NULL);
private $unsigned;
private $nullable = " NOT NULL";
private $engine = array(FALSE, "MyISAM");
var getElementsByAttribute = function(attribute, context) {
var nodeList = (context || document).getElementsByTagName('*');
var nodeArray = [];
for (var i = 0, node; node = nodeList[i]; i++) {
if ( node.getAttribute(attr) ) nodeArray.push(node);
}
return nodeArray;
};
function generatePassword(length)
{
var length = typeof length !== 'undefined' ? length : 8;
var charset = "abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
retVal = "";
for (var i = 0, n = charset.length; i < length; ++i)
{
retVal += charset.charAt(Math.floor(Math.random() * n));
}
return retVal;
<?php /** By, Travis van der Font - 2014 **/
// -- hide this - logger function - log the even how you wish --//
class logger
{
protected static function call_pie_log($arguments)
{
echo '<br/>log a bake for pie<br/>';
var_dump($arguments);
@travisfont
travisfont / new-observer.php
Last active August 29, 2015 14:01
New observer pattern (test 1)
<?php
interface imethods
{
public function add($x, $y);
public function sub($x, $y);
}
class methods
{
@travisfont
travisfont / str_replace_comparison.php
Created May 16, 2014 20:53
Comparisons of str_replace inside a loop
<?php
$aHeader = array_map(function($key)
{
return str_replace(' ', '', $key);
}, $aHeader);
foreach(aHeader as $key => $value)
@travisfont
travisfont / charts.txt
Created June 23, 2014 10:02
Link of JavaScript / CSS Charts
xCharts: a D3-based library for building custom charts and graphs
http://tenxer.github.io/xcharts/examples/
AM Charts - JavaScript Charts v.3
http://www.amcharts.com/
@travisfont
travisfont / donut_chart.js
Last active August 29, 2015 14:09 — forked from jac1013/donut_chart.js
A d3.js single value donut chart. JSFiddle: http://jsfiddle.net/8moez4j3/
var donutChart;
(function() {
var w = 500,
h = 300,
r = 100,
innerRadius = 80,
transitionsDuration = 1000,
transitionsDelay = 250,
percentageTextSize = '2.0rem';
@travisfont
travisfont / AyeEmtract.php
Created November 10, 2014 02:01
Extract Email Addresses Using Curl
<?php
/**
* AyeEmtract a class that crawls pages and
* then searches for email addresses using curl in parallel.
*
* PHP version >= 5.x
*
* @category PHP
* @author PANTUTS
* @license http://www.gnu.org/licenses/gpl.txt
@travisfont
travisfont / functions.php
Last active February 14, 2017 16:35
iCalender link integration for WordPress.
<?php
/**
* iCalendar Feed
*/
class ICAL_Export
{
// date format (WARNING: donnot change unless necessary)
const DATE_FORMAT = 'Y-m-d';