Skip to content

Instantly share code, notes, and snippets.

@gonzedge
gonzedge / Gemfile
Created January 12, 2012 23:49
Rails 3.1: Treating your '.swf' files as assets
gem 'swf_fu'
@gonzedge
gonzedge / Gemfile
Created February 3, 2012 17:29
Writing your blog posts in Markdown with Postmarkdown
gem 'postmarkdown'
@gonzedge
gonzedge / export.xml
Created February 3, 2012 20:07
Migrating your blog posts to Markdown with Upmark and Nokogiri
<?xml version="1.0" encoding="UTF-8" ?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
<!-- ... -->
<rss version="2.0"
xmlns:excerpt="http://wordpress.org/export/1.1/excerpt/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:wp="http://wordpress.org/export/1.1/"
>
@gonzedge
gonzedge / Gemfile
Created February 10, 2012 01:30
Rambling Trie: A custom Trie data structure implementation in Ruby
gem 'rambling-trie'
@gonzedge
gonzedge / index_filter.sh
Created April 27, 2012 06:37
Git: Removing sensitive data and rewriting history
git filter-branch --index-filter 'git rm --cached --ignore-unmatch -- resources/*.mp3' --prune-empty -- --all
@gonzedge
gonzedge / Gemfile
Created April 27, 2012 07:19
Introducing rambling-slider-rails: Easily include the jQuery Rambling Slider on your rails app
gem 'rambling-slider-rails'
@gonzedge
gonzedge / application_controller.rb
Created April 27, 2012 14:39
Rails - Custom 404 and 500 pages and the exception_notification gem
class ApplicationController < ActionController::Base
# ...
private
# ...
def notify(exception)
ExceptionNotifier::Notifier.exception_notification(request.env, exception,
data: {message: 'an error happened'}).deliver
@gonzedge
gonzedge / add.rb
Created July 21, 2012 14:41
Rambling Trie 0.4.1 is out!
trie << 'word' # equivalent to trie.add_branch_from('word')
@gonzedge
gonzedge / application_helper.rb
Created July 28, 2012 19:13
Pygmentizing your Rails app hosted on Heroku
module ApplicationHelper
PYGMENTIZE_URL = URI.parse 'http://pygmentize.herokuapp.com/'
def highlight_code(code, language)
sha = Digest::SHA1.hexdigest code
Rails.cache.fetch ['code', language, sha].join('-') do
Net::HTTP.post_form(PYGMENTIZE_URL, lang: language, code: code).body.html_safe
end
end
end
@gonzedge
gonzedge / each.rb
Created July 28, 2012 19:44
Version 0.4.2 of the Rambling Trie has been released!
trie.each do |word|
puts "#{word} is included!"
end