Skip to content

Instantly share code, notes, and snippets.

View bouchard's full-sized avatar

Brady Bouchard bouchard

View GitHub Profile
From b203bad71d53c4278dc97c30c0827b0430bae3ad Mon Sep 17 00:00:00 2001
From: Brady Bouchard <[email protected]>
Date: Fri, 14 Nov 2008 13:20:04 -0700
Subject: [PATCH] Added basic support for Rails 2.2 using compiled templates.
Options that affect the response header (pragma, cache-control, content-disposition) are not enabled.
Options passed to Prawn work as usual.
---
lib/prawnto/template_handler/base.rb | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
RewriteEngine on
RewriteBase /
RewriteCond SUBDIR/%{REQUEST_FILENAME} !-f
RewriteRule ^(.*) SUBDIR/$1 [L]
From 67375bb902354b41bf99cb3ffbb9b4864c86e139 Mon Sep 17 00:00:00 2001
From: Brady Bouchard <[email protected]>
Date: Mon, 1 Feb 2010 14:24:13 +1000
Subject: [PATCH] Added an option to force all tags to lowercase.
Use:
Put
TagList.force_lowercase = true
in environment.rb
---
<?php
/*
Plugin Name: Gcal Sidebar
Plugin URI: http://www.oriontechnologysolutions.com/gcal-sidebar/
Description: Pulls a Google Calendar feed and displays it in your sidebar.
Version: 1.0
Author: Orion Technology Solutions
Author URI: http://www.oriontechnologysolutions.com
*/
<?php
header('Content-type: text/csv; charset=utf-8');
$xml = simplexml_load_file('mnemosyne.xml');
$lines = array();
foreach($xml->item as $item) {
$q = $item->Q;
$q = strip_tags((string) $q, '<u><ul><li>');
$q = str_replace('<dt>','',$q);
#!/usr/bin/env ruby
## Modified from Gem Session's Dumple, available at:
## http://gem-session.com/2010/07/dumping-database-from-within-rails-project
fail_gently = ARGV.include?("--fail-gently")
gzip = ARGV.include?("--compress")
if ARGV.include?("-i")
puts "*******************************************************"
/*
* svgObject: a jQuery plugin, version: 0.1 (2010-09-03)
* @requires jQuery v.1.4.2 or later
*
* svgObject parses all SVG images linked in the document as IMG tags, and replaces
* the IMG tags with OBJECTs instead to make it all work nicely in FF 3.6+ and Safari 5+
*
* This:
*
* <img class="up svg" src="/images/up.svg" />
@bouchard
bouchard / Rules
Created November 18, 2011 06:43
Nanoc Nested Routes with RecursiveCompilation Error
compile '/' do
filter :erb
layout 'default'
end
compile '*' do
# item[:extension] returns 'html.erb' for multi-dotted filename
ext = item[:extension].nil? ? nil : item[:extension].split('.').last
if ext == 'erb'
@bouchard
bouchard / gist:1528761
Created December 28, 2011 17:18
Force Lowercase and Force Parameterize for Acts as Taggable On.
module ActsAsTaggableOn
class TagList < Array
cattr_accessor :force_lowercase, :force_parameterize
self.force_lowercase = false
self.force_parameterize = false
private
# Remove whitespace, duplicates, and blanks.
def clean!
#!/usr/bin/env ruby
# A few helpful tips about the Rules file:
#
# * The string given to #compile and #route are matching patterns for
# identifiers--not for paths. Therefore, you can’t match on extension.
#
# * The order of rules is important: for each item, only the first matching
# rule is applied.
#