Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am readingtype on github.
  • I am benweiner ( on keybase.
  • I have a public key whose fingerprint is 8322 5FD0 1BA7 2745 E26B B185 9976 A053 704F 84D2

To claim this, I am signing this object:

readingtype / rss_suparchive.php
Created Mar 1, 2012
Modify Textpattern plugin, Format the excerpt with Textile if appropriate
View rss_suparchive.php
// rss_suparchive article listing plugin
// by Rob Sable
// Version 0.1 - 11/02/2004
// Full revision history at
// Version 0.16.1 - 01/09/2006 - Fix broken file downloads. Fix inadvertent date filtering on article pages.
// Version 0.17 - 08/08/06 - Change categories to display title instead of name.
// Version 0.18 - 08/09/06 - Add showcommentscount, showzerocount, countprefix, countsuffix to suparchive and suparchive_bycat. Change to use strftime for date formatting to allow for localization. Add wildcard and exclude format for section attribute on all 3 tags. (thanks Andrew).
// 20120301 BW Add ability to decode Textile markup in excerpts. * if other markup is used this probably won't work, but if USE_TEXTILE is false it will return the raw text. See rss_format() below *
View col-widther.rb
@colwidth = 100
@margin = 10
@total = 0
def spanwidth(cols)
[(cols * @colwidth.to_i), (@margin.to_i * (cols-1))]
readingtype / col-widther-css.rb
Last active Dec 15, 2015
Moar silliness. Generate a set of CSS styles for grid columns. Fixed-width for the moment. ruby col-widther-css.rb, copy and paste.
View col-widther-css.rb
@colwidth = 100
@margin = 10
@total = 0
@numbers = ["none", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "twenty_one", "twenty_two", "twenty_three", "twenty_four", "twenty_five", "twenty_six", "twenty_seven", "twenty_eight", "twenty_nine", "thirty", "thirty_one", "thirty_two"]
def spanwidth(cols)
[(cols * @colwidth.to_i), (@margin.to_i * (cols-1))]
readingtype /
Created Aug 21, 2013
Make a base64 encoded PNG in Python 2. The URI format for an img element's src attribute is data:image/png;base64 followed by a comma, followed by the content of the base64 encoded text file.
import base64
raw = open("path/to/image.png","rb")
encoded = open("path/to/image.png.base64.txt", "w")
readingtype / flex_with_autoscroll.html
Created Oct 16, 2015
A CSS flexbox layout with a fixed header, a fixed footer, and an expanding centre section which scrolls if its content height is greater than its own height.
View flex_with_autoscroll.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>Test fixed and scrolling divs in a flexbox layout</title>
<style media="screen">
* {
border: 0;
margin: 0;
padding: 0;