Skip to content

Instantly share code, notes, and snippets.

View marcotc's full-sized avatar

Marco Costa marcotc

View GitHub Profile
@siklodi-mariusz
siklodi-mariusz / Dockerfile
Created January 30, 2018 19:40
Dockerfile example for Ruby on Rails running on Alpine Linux
FROM ruby:2.4-alpine3.7
# Install dependencies:
# - build-base: To ensure certain gems can be compiled
# - nodejs: Compile assets
# - postgresql-dev postgresql-client: Communicate with postgres through the postgres gem
# - libxslt-dev libxml2-dev: Nokogiri native dependencies
# - imagemagick: for image processing
RUN apk --update add build-base nodejs tzdata postgresql-dev postgresql-client libxslt-dev libxml2-dev imagemagick
@mkouhei
mkouhei / rbtox.sh
Created November 10, 2015 07:08
automate testing in Ruby as like the tox https://testrun.org/tox/latest/
#!/bin/sh -e
if [ -f .ruby-version ]; then
RUBY_VER=$(cat .ruby-version)
fi
test -f /etc/debian_version && PATCH="https://bugs.ruby-lang.org/attachments/download/5479/ruby-sslv3.diff"
if [ ! -z $RUBY_VER ]; then
if [ x"$(rbenv version | awk '{print $1}')" != x"$RUBY_VER" ]; then
@mattscilipoti
mattscilipoti / log_slow_queries.rb
Created February 20, 2011 05:10
Rails3: Log slow queries.
# see: http://weblog.therealadam.com/2011/02/12/simple-ruby-pleasures/comment-page-1/#comment-315
class QueryTracer < ActiveSupport::LogSubscriber
ACCEPT = %r{^(app|config|lib)}.freeze
FRAMES = 5
THRESHOLD = 300 # In ms
def sql(event)
return unless event.duration > THRESHOLD