Skip to content

Instantly share code, notes, and snippets.

View hans's full-sized avatar

Jon Gauthier hans

View GitHub Profile
--Got code from: http://www.haskell.org/haskellwiki/Why_Haskell_matters
qsort [] = []
qsort (x:xs) = qsort less ++ [x] ++ qsort more
where less = filter (<x) xs
more = filter (>=x) xs
#!/usr/bin/php -q
<?php
// modified from http://3v1n0.tuxfamily.org/scripts/detextile/HTML-to-Textile.php
class html2textile {
function detextile($text) {
$text = preg_replace("/(<\/?)(\w+)([^>]*>)/e", "'\\1'.strtolower('\\2').'\\3'", $text);
$text = preg_replace("/<br[ \/]*>\s*/","\n",$text);
$text = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $text);
$text = stripslashes($text);
$oktags = array('p','ol','ul','li','i','b','em','strong','span','a','h[1-6]',
@hans
hans / gist:7393
Created August 27, 2008 01:39 — forked from defunkt/gist:7391
task :spec do
require 'rubygems'
Gem::manage_gems
require 'rake/gempackagetask'
gemspec = ENV['gemspec'] || ''
@spec = eval(File.read(gemspec + '.gemspec'))
Rake::GemPackageTask.new(@spec) do |pkg|
pkg.need_tar = true