Skip to content

Instantly share code, notes, and snippets.

View purplefoot's full-sized avatar

Ian Webb purplefoot

  • Modular Reality
  • London, UK
View GitHub Profile
@purplefoot
purplefoot / gist:3480630
Created August 26, 2012 14:49
Write only Perl code
sub flatten_header {
my $msg = shift;
for (my $i = 0; $i <= scalar(@{$msg}) ; $i++) {
last if @$msg[$i] =~ /^\n/;
if (@$msg[$i] =~ /^\s+(.*)/) {
chomp @$msg[$i-1];
@$msg[$i-1] .= " $1\n";
splice (@$msg, $i--, 1);
}
# Custom ParamsParser that can digest "multipart/related" requests
# to use, replace default Rails "ActionController::ParamsParser" middleware via:
# ActionController::Dispatcher.middleware.swap 'ActionController::ParamsParser', MultipartRelatedParamsParser
class MultipartRelatedParamsParser
ActionController::Base.param_parsers[Mime::XML] = :xml_simple
ActionController::Base.param_parsers[Mime::JSON] = :json
def initialize(app)
@app = app
=== Epic Snow Leopard Upgrayyyyd Guide ===
Son, you’re now living in the land of 64-bit systems.
That means that some of your 32-bit shit is now broken.
Not all is lost.
== Fixing MySQL weirdness