Skip to content

Instantly share code, notes, and snippets.

View xeoncross's full-sized avatar

David Pennington xeoncross

View GitHub Profile
<?php
require_once('/home/alix/_.php');
ph();
function Purify($html, $tags = null)
{
$html = preg_replace('~<(script|style)[^>]*>.*?(?:</\1>|\z)~is', '', $html);
$html = strip_tags($html, '<' . implode('><', array_keys((array) $tags)) . '>');
@xeoncross
xeoncross / run.php
Created August 30, 2011 01:45 — forked from greut/run.php
A web server in pure PHP (non-concurrent and concurrent)
#!/usr/bin/env php
<?php
$app = function($request) {
$body = <<<EOS
<!DOCTYPE html>
<html>
<meta charset=utf-8>
<title>Hello World!</title>
@xeoncross
xeoncross / slider.html
Created August 31, 2011 03:19 — forked from jsok/slider.html
Simple jquery slider
<!DOCTYPE html>
<html lang="en-GB">
<head>
<title>iTunes slider</title>
<link rel="stylesheet" href="style.css" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/slider.js"></script>
</head>
@xeoncross
xeoncross / gist:1250888
Created September 29, 2011 14:49 — forked from TheNicholasNick/gist:1040044
node.js SMTP Server
/*
smtpd.js is SMTP server written for node.js
this one works with node 0.4.8 and is standalone
sudo node smtpd.js
MIT License
*/
@xeoncross
xeoncross / $w.js
Created November 2, 2011 18:03 — forked from rmanalan/$w.js
Illustration of a jQuery like object
var $w = function(){
var $w = function(){
return new $w.init;
}
$w.prototype = {
// add all of the methods/props you want accessible as $w().method() or $w().prop here:
init: function(){
console.log('init called');
},
@xeoncross
xeoncross / Email.php
Created November 10, 2011 20:14 — forked from anonymous/Email.php
<?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);
@xeoncross
xeoncross / postgres-install
Created November 21, 2011 21:06 — forked from mikeclarke/postgres-install
Basic PostgreSQL install
# Install the postgres packages
yum install postgresql postgresql-server
# Configure postgresql to start automatically on boot
chkconfig postgresql on
# Stat posgresql
service postgresql start
# Switch to postgres user (required to make initial connection to postgresql with default configuration)
su - postgres
# Make initial connection to the database to test connectivity
psql -d template1 -U postgres
@xeoncross
xeoncross / LICENSE.txt
Created December 17, 2011 19:44 — forked from jed/LICENSE.txt
bind and unbind events
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@xeoncross
xeoncross / letter_rearranger.class.php
Created January 12, 2012 18:50 — forked from awojnowski/letter_rearranger.class.php
Rearranges and uses the letters of a word to form all possible other words, in PHP.
<?php
/*
letter_rearranger.class.php
Created by Aaron Wojnowski, 2012
-- USAGE --
1) Create a .txt wordlist with words separated with a newline. Example:
@xeoncross
xeoncross / css-min.php
Created April 17, 2012 16:22 — forked from timw4mail/css-min.php
CSS Minification function
<?php
//Function for compressing the CSS as tightly as possible
function compress($buffer) {
//Remove CSS comments
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
//Remove tabs, spaces, newlines, etc.
$buffer = preg_replace('`\s+`', ' ', $buffer);