Skip to content

Instantly share code, notes, and snippets.

@moeffju
moeffju / haml-scss-filter.rb
Created January 20, 2012 10:19
SCSS filter for Haml
module Haml::Filters
module Scss
include Base
lazy_require 'sass/plugin'
def render(text)
::Sass::Engine.new(text, ::Sass::Plugin.engine_options.merge(:syntax => :scss)).render
end
end
end
@moeffju
moeffju / gist:1115879
Created July 30, 2011 19:18
brew upgrade / brew install -v poppler fails
==> Downloading http://poppler.freedesktop.org/poppler-0.16.7.tar.gz
File already downloaded in /Users/moeffju/Library/Caches/Homebrew
/usr/bin/tar xf /Users/moeffju/Library/Caches/Homebrew/poppler-0.16.7.tar.gz
==> ./configure --disable-dependency-tracking --prefix=/usr/local/Cellar/poppler/0.16.7
./configure --disable-dependency-tracking --prefix=/usr/local/Cellar/poppler/0.16.7
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
@moeffju
moeffju / gist:894670
Created March 30, 2011 15:59
If you want to use clickheat, but don't want to bother with mixing PHP and Ruby, or getting mixed-content warnings on SSL, etc.
get '/c' => proc { |env|
request = Rack::Request.new(env)
params = request.params
unless params['x'] && params['y'] && params['w'] && params['g'] && params['s'] && params['b'] && params['c']
[200, {}, 'KO']
else
final = [params['s'].gsub(/[^a-z_0-9\-]+/, '_'), params['g'].gsub(/[^a-z_0-9\-]+/, '_')].join(',')
log_path = Rails.root.join('log', 'clickheat', final)
FileUtils.mkdir_p(log_path)
File.open([log_path, "#{Time.now.strftime('%Y-%m-%d')}.log"].join('/'), 'a') do |f|