Skip to content

Instantly share code, notes, and snippets.

View evanpurkhiser's full-sized avatar

Evan Purkhiser evanpurkhiser

View GitHub Profile
@evanpurkhiser
evanpurkhiser / gist:1794729
Created February 11, 2012 00:57
Git configuration
[user]
name = Your Name
email = your+email@gmail.com
[core]
autocrlf = false
[alias]
st = status -sb
ci = commit
ul {
margin: 20px auto;
width: 500px;
padding: 0
list-style: none;
}
ul li {
float: left;
}
@evanpurkhiser
evanpurkhiser / sudoku.js
Created April 11, 2012 02:36
Almost complete sudoku solver using recursion
/**
* Sudoku solver. Solves sudoku puzzles
* recursively using brute-force backtracking.
*
* The given puzzle should be an array of integer values
* where the '0' value represents an unsolved cell in the
* puzzel. The returned puzzel will be in the same format
*
* @param {Array} puzzle The partially solved puzzel
* @param {Integer} index The current cell to solve
<?php
echo ' <link href="common/style.css" rel="stylesheet" type="text/css" />';
echo "<body onLoad='document.getElementById('song').select();'>";
//create a PDO object to interface with the database
try {
$dbh = new PDO('mysql:localhost:3306', 'root', '');
}
catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
<?php
require('File.Class.php');
Class lotto{
public function init(){
$dbName = "lotto";
try {
$dbh = new PDO('mysql:localhost:3306', 'root', '');
<?php
foreach ($games as $game)
{
// The default values array.. all empty
$default = array_combine($games, array_fill(0, length($games), '-'));
try
{
$sth = $dbh->prepare("SELECT * FROM $game ORDER BY date $sort");
@evanpurkhiser
evanpurkhiser / Makefile
Created April 20, 2012 15:54
Build files to generate diagram images on yuml.me from the source text
# yuml.me diagram makefile
# generate the class diagram images as pngs
#
all: UsecaseDiagram/diagram.txt.png Iteration1/ClassDiagram/diagram.txt.png Iteration2/ClassDiagram/diagram.txt.png Iteration3/ClassDiagram/diagram.txt.png
clean:
rm Iteration1/ClassDiagram/diagram.txt.png
rm Iteration2/ClassDiagram/diagram.txt.png
rm Iteration3/ClassDiagram/diagram.txt.png
/**
Inner class to handle different sorting algorithms
*/
private class Sort {
private int data[];
private int size;
/**
Constructor
app = proc do |env|
[200, { "Content-Type" => "text/html" }, ["hello <b>world</b>"]]
end
run app
<VirtualHost *:80>
Servername dd.h1x.com
ServerAdmin evanpurkhiser@gmail.com
DocumentRoot /var/www
RewriteEngine on
RewriteLog rewrite.log
RewriteLogLevel 9