Skip to content

Instantly share code, notes, and snippets.

View beastaugh's full-sized avatar

Benedict Eastaugh beastaugh

View GitHub Profile
@beastaugh
beastaugh / remove_post_navigation.php
Created December 30, 2008 22:52
Remove next & previous post navigation.
<?php
/*
Plugin Name: Remove Post Navigation
Plugin URI: http://tarskitheme.com/
Description: Remove next & previous post navigation.
Author: Benedict Eastaugh
Version: 1.0
Author URI: http://extralogical.net/
*/
(define (factorial n)
(define (iter product counter)
(if (> counter n)
product
(iter (* product counter)
(+ counter 1))))
(iter 1 1))
;Approximates e by taking the first n terms of the series.
(define (e-approx n)
@beastaugh
beastaugh / classy_pages.php
Created January 10, 2009 00:37
Add a class of 'page' to the body element on WordPress pages.
<?php
/*
Plugin Name: Classy Pages
Plugin URI: http://tarskitheme.com/
Description: Add a class of <code>page</code> to the <code>body</code> element on pages.
Author: Benedict Eastaugh
Version: 1.0
Author URI: http://extralogical.net/
*/
@beastaugh
beastaugh / sidebarless_pages.php
Created January 13, 2009 16:47
Remove Tarski's sidebar from pages.
<?php
/*
Plugin Name: Sidebarless Pages
Plugin URI: http://tarskitheme.com/
Description: Remove Tarski's sidebar from pages.
Author: Benedict Eastaugh
Version: 1.0
Author URI: http://extralogical.net/
*/
<?php
/*
Plugin Name: Unlinked Posts
Plugin URI: http://tarskitheme.com/
Description: Hide the next & previous posts navigation in Tarski.
Author: Benedict Eastaugh
Version: 1.0
Author URI: http://extralogical.net/
*/
@beastaugh
beastaugh / wp_update.rb
Created January 16, 2009 00:51
WordPress upgrade script
#!/usr/bin/env ruby
require 'pathname'
CRUFT = %w{index.php license.txt readme.html wp-content/plugins/hello.php}
SITES = %w{tarskitheme.com extralogical.net}.map do |path|
Pathname.new(ENV['HOME']) + "public_html" + path + "public/wp"
end
SITES.each do |site|
@beastaugh
beastaugh / FizzBuzz.hs
Created January 24, 2009 02:09
FizzBuzz in Haskell; won't win any Code Golf competitions
module Main (main) where
main :: IO ()
main = putStr . unlines . take 100 $ fizzBuzz
fizzBuzz :: [String]
fizzBuzz = map (either show id . fizzes) [1..]
fizzes :: Int -> Either Int String
fizzes n | 15 `divides` n = Right "FizzBuzz"
@beastaugh
beastaugh / rm_navbar.php
Created February 14, 2009 20:17
Remove Tarski's navbar.
<?php
/*
Plugin Name: Remove Navbar
Plugin URI: http://tarskitheme.com/
Description: Remove Tarski's navbar.
Author: Benedict Eastaugh
Version: 1.0
Author URI: http://extralogical.net/
*/
@beastaugh
beastaugh / rgb_to_hsl.rb
Created March 5, 2009 15:31
An RGB to HSL colour coverter
require 'mathn'
require 'rational'
def rgb_to_hsl(red, green, blue)
red, green, blue = rgb = [red, green, blue].map {|i| Rational(i, 255) }
max, min = rgb.max, rgb.min
huer = lambda {|num, a| 60 * (num / (max - min)) + a }
lightness = (max + min) / 2