Skip to content

Instantly share code, notes, and snippets.

View Xophmeister's full-sized avatar

Christopher Harrison Xophmeister

View GitHub Profile
@Xophmeister
Xophmeister / error.php
Created July 24, 2012 21:45
Simple, session-persistent error handling
<?php
class ErrorStack {
private $errorPage;
private $stack;
function __construct($errorPage = 'showErrors.php') {
$this->errorPage = $errorPage;
}
public function add($desc) {
@Xophmeister
Xophmeister / gist:3089424
Created July 11, 2012 10:09
Extreme E-Mail Obfuscation
<html>
<head>
<title>Extreme E-Mail Obfuscation</title>
<style>
.something-else {
font-size: 15pt;
}
</style>
<script>
@Xophmeister
Xophmeister / gist:3040407
Created July 3, 2012 15:20
Playing with Primes in Python
import math
import random
class PrimeBuilder:
_p = set()
_maxChecked = 0
def __init__(self, p = {2, 3, 5}):
self._p = p
self._maxChecked = max(p)
@Xophmeister
Xophmeister / msTimer.d
Created June 29, 2012 13:18
Just a silly little timer!
import std.stdio, core.time;
class msTimer {
TickDuration start;
this() { reset(); }
long split() { return (TickDuration.currSystemTick() - start).msecs(); }
void reset() { start = TickDuration.currSystemTick(); }
}
@Xophmeister
Xophmeister / bp.d
Created June 28, 2012 13:28
Branch Prediction Benchmarking in D
import std.stdio, std.random, core.time;
void main() {
int data[32768];
foreach(ref x; data)
x = uniform(0, 256);
data.sort;