Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Wright DaveRandom

View GitHub Profile
View URL.php
<?php
/**
* Class URL
*
* @property string $scheme
* @property string $user
* @property string $pass
* @property string $host
* @property string $port
View bahhumbug.user.js
// ==UserScript==
// @name Bah humbug
// @description Disable the php.net 2014-04-01 scripts
// @version 1.0
// @author DaveRandom
// @namespace https://github.com/DaveRandom
// @match *://php.net/*
// @match *://*.php.net/*
// ==/UserScript==
@DaveRandom
DaveRandom / keybase.md
Created Sep 18, 2014
Verifying keybase identity
View keybase.md

Keybase proof

I hereby claim:

  • I am DaveRandom on github.
  • I am daverandom (https://keybase.io/daverandom) on keybase.
  • I have a public key whose fingerprint is 041D 03AE C3A0 4031 AEB8 5363 1618 4931 222E AD5B

To claim this, I am signing this object:

@DaveRandom
DaveRandom / file.php
Last active Dec 12, 2015
Simple file upload manager lib
View file.php
<?php
namespace Upload;
class File implements IFile {
/**
* The meta data about the file (from the $_FILES array)
*
* @var array $uploadMeta
@DaveRandom
DaveRandom / Cell.php
Last active Dec 15, 2015
Small library for manipulating Excel spreadsheets using COM on a Windows machine with Microsoft Office is installed
View Cell.php
<?php
/**
* Class for objects representing a single cell in an Excel worksheet
*
* PHP version 5.3/Windows, requires Microsoft Office Excel to be installed on the host system
*
* @package ExcelCOM
* @author Chris Wright <info@daverandom.com>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
@DaveRandom
DaveRandom / gist:5201273
Created Mar 20, 2013
Bit-shift PHP strings.
View gist:5201273
<?php
function str_left_shift($str, $count) {
$bytes = floor($count / 8);
if ($bytes) {
$str = substr($str, $bytes)
. str_repeat("\x00", $bytes);
$count = $count % 8;
View mysql_comment.md
[**Please, don't use `mysql_*` functions in new code**](http://stackoverflow.com/q/12859942). They are no longer maintained [and are officially deprecated](https://wiki.php.net/rfc/mysql_deprecation). See the [**red box**](http://php.net/mysql-connect)? Learn about [*prepared statements*](http://en.wikipedia.org/wiki/Prepared_statement) instead, and use [PDO](http://php.net/pdo) or [MySQLi](http://php.net/mysqli) - [this article](http://php.net/mysqlinfo.api.choosing) will help you decide which. If you choose PDO, [here is a good tutorial](http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers).

Please, don't use mysql_* functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or [MySQLi](http://php.net/mysq

View mysql_comment.markdown
[**Please, don't use `mysql_*` functions in new code**](http://bit.ly/phpmsql). They are no longer maintained [and are officially deprecated](http://j.mp/XqV7Lp). See the [**red box**](http://j.mp/Te9zIL)? Learn about [*prepared statements*](http://j.mp/T9hLWi) instead, and use [PDO](http://php.net/pdo) or [MySQLi](http://php.net/mysqli) - [this article](http://j.mp/QEx8IB) will help you decide which. If you choose PDO, [here is a good tutorial](http://j.mp/PoWehJ).

Please, don't use mysql_* functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.

@DaveRandom
DaveRandom / RegExp.bas
Created May 15, 2013
VB classic regular expressions that suck (a bit) less
View RegExp.bas
Attribute VB_Name = "RegExp"
Option Compare Database
Option Explicit
Public Enum REGEXP_PARSEERROR
REGEXP_PARSEERROR_INVALIDWRAPPER = 1
REGEXP_PARSEERROR_UNBALANCEDESCAPES = 2
REGEXP_PARSEERROR_UNKNOWNMODIFIER = 3
REGEXP_PARSEERROR_SYNTAXERROR = 4
REGEXP_PARSEERROR_UNEXPECTEDQUANTIFIER = 5
@DaveRandom
DaveRandom / ImageRandomizer.js
Created Jul 1, 2013
Prototype for object which randomly displays a list of images with fading transitions
View ImageRandomizer.js
/*jslint browser: true, plusplus: true, regexp: true, white: true */
/**
* Prototype for object which randomly displays a list of images with fading transitions
*
* @package ImageRandomizer <https://gist.github.com/DaveRandom/5899497>
* @author Chris Wright <https://github.com/DaveRandom>
* @copyright Copyright (c) Chris Wright <https://github.com/DaveRandom>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.127