Skip to content

Instantly share code, notes, and snippets.

View weaver's full-sized avatar

Ben Weaver weaver

View GitHub Profile
@weaver
weaver / x-forwarded-host.php
Created April 30, 2011 17:27
Honor the `X-Forwarded-Host` header for the duration of a single request in WordPress.
<?php
/*
# X-Forwarded-Host #
Honor the `X-Forwarded-Host` header for the duration of a single
request in WordPress.
## Read Me First ##
@weaver
weaver / org-capture-link.el
Created March 8, 2012 14:16
Capture an org-mode stored link. Add it to the kill-ring in a format suitable for use as a version control commit message.
@weaver
weaver / .gitignore
Created October 2, 2012 15:31
S3 Upload Example
node_modules
.#*
*~
@weaver
weaver / primes.clj
Created October 16, 2014 13:42
Naive Primes in Clojure
;;; Naive Primes
;;;
;;; Produce a sequence of primes using a naive trial-division
;;; algorithm. This is very slow, but easy to understand at a
;;; glance. It's useful for unit testing.
;;;
;;; Optimizations:
;;;
;;; + Only test odd numbers for primality
;;; + Only do trial division up to the square root