Skip to content

Instantly share code, notes, and snippets.

View bhollis's full-sized avatar

Ben Hollis bhollis

View GitHub Profile
@bhollis
bhollis / .htaccess
Created March 25, 2012 22:58
Serving pre-gzipped assets from Apache
AddEncoding gzip .gz
RewriteEngine on
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{HTTP_USER_AGENT} !Konqueror
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule ^(.*)\.css$ $1.css.gz [QSA,L]
RewriteRule ^(.*)\.js$ $1.js.gz [QSA,L]
RewriteRule ^(.*)\.html$ $1.html.gz [QSA,L]
@bhollis
bhollis / simple_cache.rb
Created June 3, 2011 02:43
Simple Rails caching library
# A simple expiring cache suitable for use with the :file_store cache store.
# Not particularly threadsafe, and can duplicate work if there are multiple
# requests for stale data at the same time.
#
# Usage:
# SimpleCache.fetch('my_data', 15.minutes) do
# MyModel.expensive_query
# end
#
# Make sure to set up the cache to use :file store in your environment.rb,
@bhollis
bhollis / GlowBack.pde
Created June 3, 2011 02:38
Arduino program for animating LEDs for the GlowBack ceramic sculpture
/*
Arduino program for animating LEDs for the GlowBack ceramic sculpture
http://benhollis.net/blog/2010/02/04/glowback-arduino-powered-glowing-ceramic-creature/
Copyright (C) 2010 by Benjamin Hollis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell