Skip to content

Instantly share code, notes, and snippets.

# stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb
# and made a lot more robust by me
# this implementation uses erb by default. if you want to use any other template mechanism
# then replace `erb` on line 13 and line 17 with `haml` or whatever
module Sinatra::Partials
def partial(template, *args)
template_array = template.to_s.split('/')
template = template_array[0..-2].join('/') + "/_#{template_array[-1]}"
options = args.last.is_a?(Hash) ? args.pop : {}
options.merge!(:layout => false)
@benhoskings
benhoskings / ruby-2-cert-issue-fix.sh
Last active March 21, 2016 18:30
Ruby 2.0 CA cert issue fix
# If you're having cert issues on ruby 2.0.0-p0, the issue is most likely that ruby can't
# find the required intermediate certificates. If you built it via rbenv/ruby-build, then
# the certs are already on your system, just not where ruby expects them to be.
# When ruby-build installs openssl, it installs the CA certs here:
~/.rbenv/versions/2.0.0-p0/openssl/ssl/cacert.pem
# Ruby is expecting them here:
$(ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE')
# Which for me, is this path:
@pcreux
pcreux / 000_intro.md
Created December 5, 2012 16:30
Rails++ - Talk given at Lyon.rb meetup in October 2012

Enterprise Rails

   WAT?

Lyon.rb - Octobre 2012

Philippe Creux - @pcreux - http://pcreux.com

@paraboul
paraboul / cover.html
Created August 23, 2012 00:04
random cover
<html>
<head></head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script>
var canvas = document.getElementById("canvas").getContext('2d');
canvas.shadowColor="#000";
@markoa
markoa / rails3-installation-fail-on-rdoc
Created September 5, 2010 11:35
Rails 3 installation fails on Linux with "File not found: lib" before making rdocs
marko@harman:~$ sudo gem install rails
[sudo] password for marko:
Successfully installed activesupport-3.0.0
Successfully installed i18n-0.4.1
Successfully installed activemodel-3.0.0
Successfully installed rack-1.2.1
Successfully installed rack-mount-0.6.13
Successfully installed tzinfo-0.3.23
Successfully installed erubis-2.6.6
Successfully installed actionpack-3.0.0