Skip to content

Instantly share code, notes, and snippets.

View icco's full-sized avatar
🏠
Working from home

Nat Welch icco

🏠
Working from home
View GitHub Profile
@icco
icco / test
Created January 22, 2009 04:38
huh?
@icco
icco / gist:53513
Created January 27, 2009 20:15
A look into gists
<?php print "It's a trap!"; ?>
@icco
icco / gist:66792
Created February 19, 2009 08:02
[gist: ####] formatting with PHP
<?php
// Gist replacement inspired by http://github.com/guitsaru/code-feather/
if(preg_match("/\[gist: ([0-9]+)\]/i", $out, $matches)) {
return '<script src="http://gist.github.com/'.$matches[1].'.js"></script>';
}
// Can also be done in one line.
$out = preg_replace("/\[gist: ([0-9]+)\]/i", '<script src="http://gist.github.com/\\1.js"></script>', $out);
?>
@icco
icco / gist:70322
Created February 25, 2009 18:02
To list files in a directory in a safe manor
<?php
/**
* A file that lists all files in a directory, ignoring hidden files and itself.
* Also this uses a natural sort and a simple stylesheet.
*/
?>
<html>
<head>
<title>Nat's School Files</title>
<link href="style.css" rel="stylesheet" type="text/css"/>
@icco
icco / gist:70397
Created February 25, 2009 20:37
For converting plain text to html
<?php
/**
Basically is used to convert plain text to html.
@author Nat Welch
*/
function htmlify($str)
{
// replace special characters with HTML entities
@icco
icco / gist:72453
Created March 1, 2009 19:44
Recursive Fibinocci Sequence in C
void doWork(int a1,int a2,int n)
{
int a3 = 0;
if(n <= 2)
{
return;
}
else
{
#include <stdio.h>
#include <linux/unistd.h> /* Defines _syscall0 and has mygetpid syscall number */
#include <errno.h> /* need this for syscall0 macro too */
_syscall0(long, quad)
#include <sys/types.h>
#include <sys/wait.h>
#ifndef QNUM
#define QNUM 0
@icco
icco / gist:72972
Created March 2, 2009 20:39
Cplug 09 Shirt Results
Final Shirt Results
http://users.csc.calpoly.edu/~nwelch/files/ShirtIdeas/cplug1.gif 6 7%
http://users.csc.calpoly.edu/~nwelch/files/ShirtIdeas/cplug2.png 7 8%
http://users.csc.calpoly.edu/~nwelch/files/ShirtIdeas/cplug3.png 5 6%
http://users.csc.calpoly.edu/~nwelch/files/ShirtIdeas/cplug4.png 10 12%
http://users.csc.calpoly.edu/~nwelch/files/ShirtIdeas/cplug5.png 17 20%
http://users.csc.calpoly.edu/~nwelch/files/ShirtIdeas/cplug6.png 23 28%
http://users.csc.calpoly.edu/~nwelch/files/ShirtIdeas/sadistic0.jpg 1 1%
http://users.csc.calpoly.edu/~nwelch/files/ShirtIdeas/sadistic1.jpg 1 1%
@icco
icco / gist:101946
Created April 26, 2009 08:02
A copy of Markdown 1.0.1
#!/usr/bin/perl
# Markdown -- A text-to-HTML conversion tool for web writers
#
# Copyright (c) 2004 John Gruber
# <http://daringfireball.net/projects/markdown/>
#
package Markdown;
require 5.006_000;
<?php
phpinfo();
?>