Skip to content

Instantly share code, notes, and snippets.

View mdeering's full-sized avatar
👨‍💻
Computer, computer, computer

Michael Deering mdeering

👨‍💻
Computer, computer, computer
View GitHub Profile
@mdeering
mdeering / config.ru
Created May 1, 2012 20:49 — forked from brookr/config.ru
Rackup file I use for running WordPress on Pow
# config.ru for Pow + Wordpress, based on http://stuff-things.net/2011/05/16/legacy-development-with-pow/
# added hackery to work around wordpress issues - Patrick Anderson (patrick@trinity-ai.com)
# clearly this could be cleaner, but it does work
require 'rack'
require 'rack-legacy'
require 'rack-rewrite'
# patch Php from rack-legacy to substitute the original request so
# WP's redirect_canonical doesn't do an infinite redirect of /
@mdeering
mdeering / action_mailer.rb
Created December 15, 2011 07:57
Initializer for adding the full name to the email address for SMTP
module ActionMailer
class Base
def perform_delivery_smtp(mail)
destinations = mail.destinations
mail.ready_to_send
sender = (mail['return-path'] && mail['return-path'].spec) || Array(mail.from).first
smtp = Net::SMTP.new(smtp_settings[:address], smtp_settings[:port])
smtp.enable_starttls_auto if smtp_settings[:enable_starttls_auto] && smtp.respond_to?(:enable_starttls_auto)
smtp.start(smtp_settings[:domain], smtp_settings[:user_name], smtp_settings[:password],
@mdeering
mdeering / multi-firefox-fixer.sh
Created September 6, 2011 18:27 — forked from cowboy/multi-firefox-fixer.sh
Multi-Firefox Fixer: Run multiple versions of Firefox simultaneously! (note: doesn't work on Windows)
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" ]; then cat <<EOF
Multi-Firefox Fixer - v0.2 - 4/26/2011
http://benalman.com/
Usage: `basename "$0"`
Run this shell script from beside (in the same parent directory as) one or more
Firefox*.app or Aurora*.app applications and it will "fix" those Firefoxes to
module I18n
def self.reload!
end
end
<html>
<head>
<title>Header test for PDFKit</title>
</head>
<body>
<h3>This is your header.</h3>
</body>
</html>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.0"
width="450pt"
height="450pt"
id="svg1522">
<defs
@mdeering
mdeering / attribute_normalizer.rb
Created November 26, 2010 05:31
replace the default strip with squish
AttributeNormalizer.configure do |config|
config.normalizers[:squish] = lambda do |value, options|
value.is_a?(String) ? value.squish : value
end
config.default_normalizers = :squish, :blank
end
module Admin::SnippetHelper
def render_snippet(snippet_name, args = nil)
RedCloth.new(Liquid::Template.parse(Snippet.find_by_title!(snippet_name).content).render args).to_html.html_safe
rescue ActiveRecord::RecordNotFound => error
error.message.html_safe
end
end
@mdeering
mdeering / dragonfly.rb
Created October 26, 2010 20:08
config/initializers/dragonfly.rb
require 'dragonfly/rails/images'
app = Dragonfly[:images]
app.configure_with(:rmagick, :use_filesystem => false)
########################## Shell Prompt ####################################
LIGHT_BLUE="\[\033[1;34m\]"
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
parse_git_branch (){
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}