Skip to content

Instantly share code, notes, and snippets.

@dtalley
dtalley / build-site.php
Last active January 17, 2023 07:38
Small PHP script to build a web application from a set of source files, combine it into as few files as possible (as defined by you), and minify/compress everything using a few useful tools. This particular script requires that you have PHP, Ruby, and Java installed, as well as the SASS gem, and you also need the YUICompressor and HTMLCompressor…
<?php
//You can pass -nm into the php script and no minification will occure (for debug purposes)
$minify = true;
foreach($argv as $arg)
{
if( $arg == "-nm" )
{
$minify = false;
}
@dtalley
dtalley / ByteReader.cpp
Created March 29, 2012 08:01
Small C++ utility for reading binary data from a byte array
#include "ByteReader.h"
using namespace Orionark::Utility;
ByteReader::ByteReader(char *data)
: data(data),
pointer(0)
{
if( O32_HOST_ORDER == O32_LITTLE_ENDIAN )
{
@dtalley
dtalley / PGSQLConnection.php
Created January 12, 2012 21:43
PHP PostgreSQL Database Abstraction
<?php
if( !defined( "INCLUDE_DIR" ) ) {
define( "INCLUDE_DIR", "" );
}
require_once INCLUDE_DIR . "PGSQLQuery.php";
/**
* Class to allow an easy, elegant way to
* connect to a PostgreSQL database.
@dtalley
dtalley / datatree.php
Created December 21, 2011 01:39
PHP Data Tree
<?php
/**
* Useful for keeping track of a tree-like
* collection of data, for templates, API
* returns, and accessing it with simple,
* powerful paths, much like a file structure
* or XPath.
*/
class DataTree {
@dtalley
dtalley / as3anderssontree.as
Created December 2, 2011 08:30
ActionScript 3 Andersson Tree
package {
public class AnderssonTree {
public function AnderssonTree() {}
public override function add( node:TreeNode ):void {
_root = insert( _root, node );
_size++;
}
@dtalley
dtalley / ByteMap.as
Created December 1, 2011 08:52
A simple class for quickly and easily setting specific bits in an ActionScript ByteArray, uses Azoth fastmem class
package {
import flash.errors.EOFError;
import flash.text.TextField;
import flash.utils.ByteArray;
import flash.utils.Endian;
import com.buraks.utils.fastmem;
public class ByteMap extends ByteArray {
private var _length:uint;