Skip to content

Instantly share code, notes, and snippets.

View xeoncross's full-sized avatar

David Pennington xeoncross

View GitHub Profile
@tony-landis
tony-landis / array-to-texttable.php
Created December 3, 2008 08:00
PHP: Array to Text Table Generation Class
<?php
/**
* Array to Text Table Generation Class
*
* @author Tony Landis <tony@tonylandis.com>
* @link http://www.tonylandis.com/
* @copyright Copyright (C) 2006-2009 Tony Landis
* @license http://www.opensource.org/licenses/bsd-license.php
*/
class ArrayToTextTable
@serverdensity
serverdensity / Generate a list of timezones with PHP
Created March 20, 2009 20:52
Generate a list of timezones with PHP
http://www.php.net/manual/en/function.timezone-identifiers-list.php
<?php
$zones = timezone_identifiers_list();
foreach ($zones as $zone)
{
$zoneExploded = explode('/', $zone); // 0 => Continent, 1 => City
// Only use "friendly" continent names
require 'rubygems'
require 'sinatra'
require 'redis'
# To use, simply start your Redis server and boot this
# example app with:
# ruby example_note_keeping_app.rb
#
# Point your browser to http://localhost:4567 and enjoy!
#
anonymous
anonymous / Email.php
Created May 1, 2009 02:09
<?php
function Email($name, $from, $to, $subject, $message, $bcc = null, $attachments = null)
{
ini_set('SMTP', 'localhost');
ini_set('sendmail_from', $from);
$name = filter_var($name, FILTER_SANITIZE_STRING);
$from = filter_var($from, FILTER_SANITIZE_EMAIL);
$subject = filter_var($subject, FILTER_SANITIZE_STRING);
@eb1024
eb1024 / Doo.php
Created September 14, 2009 16:33
<?php
function DB($query)
{
static $db = null;
static $result = array();
if (is_file($query) === true)
{
$db = new PDO('sqlite:' . $query, null, null, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING));
@jwage
jwage / SplClassLoader.php
Last active February 27, 2024 16:37
Add MIT license.
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
@thenewbie
thenewbie / echo-server.php
Created November 21, 2009 10:58
PHP is UNIX - Simple preforking echo server in PHP
<?
/*
PHP is UNIX - Simple preforking echo server in PHP
**************************************************
The code here is related to:
http://tomayko.com/writings/unicorn-is-unix
http://jacobian.org/writing/python-is-unix/
http://plasmasturm.org/log/547/ - perl is unix
@crofty
crofty / postgres setup ubuntu
Created December 2, 2009 21:34
Postgres setup
# Postgres install on ubuntu
sudo apt-get install postgresql
# Log in with
sudo -u postgres psql postgres
# change password by issuing
\password postgres
# create databases with
<?php
$g=$_GET;$c=@$g['c']?$g['c']:'Home';
if(!@include"c/$c.php")die('fail');
$m=method_exists($c,$m=@$g['m'])?$m:'index';
$o=new$c();$o->$m($g);
@kellishaver
kellishaver / dropdown_menu.js
Created January 4, 2010 23:50
dead-simple dropdown menus with jquery
jQuery.fn.dropdown = function() {
var menu = $(this);
var ddm = 0;
menu.find('li ul').hide();
menu.find('li').bind('mouseover', function() {
ddm = $(this).find('ul li').unbind('mouseout');
ddm = $(this).find('ul').stop().show();
ddm.prev().addClass('on');
}).bind('mouseout', function() {
if(ddm) {