Skip to content

Instantly share code, notes, and snippets.

View optparse-template.rb
#!/usr/bin/env ruby
#/ Usage: <progname> [options]...
#/ How does this script make my life easier?
# ** Tip: use #/ lines to define the --help usage message.
$stderr.sync = true
require 'optparse'
# default options
flag = false
option = "default value"
@svenfuchs
svenfuchs / README.md
Created Mar 19, 2012
minimal activerecord standalone migrations
View README.md

In your Gemfile add:

group :development, :test do
  gem 'micro_migrations', :git => 'git@gist.github.com:33e9f92c229eb808a4fa.git'
end

You might want to add something like this to the Rakefile of apps that use a gem that uses micro_migrations:

ENV['SCHEMA'] = "#{Gem.loaded_specs['your-gem-name'].full_gem_path}/db/schema.rb"
@svenfuchs
svenfuchs / _readme.md
Last active Jan 3, 2018
tmux-vim integration to transparently switch between tmux panes and vim split windows tmux based version that does not require a vim plugin
View _readme.md

Based on Mislav's gist and vim-tmux-navigator.

Since tmux hosts vim I disliked that I had to install a vim plugin for this. Instead I think it's cleaner to control vim from tmux.

My actual goal was to achive the following behaviour though (I have a default setup similar to the one Mislav shows in the gist. Two vertically split tmux panes, where the left one hosts vim, which has two vertically split windows):

  • On the leftmost window in vim: when I hit C-h (do not wrap to the rightmost tmux pane, but) zoom the left tmux pane.
  • On the rightmost tmux pane: when I hit C-l (do not wrap to the leftmost tmux pane, but) zoom the right tmux pane.
  • All other navigation: work as given in Mislav's gist
@svenfuchs
svenfuchs / gist:2063855
Created Mar 17, 2012
Developing with dependent local gem repositories
View gist:2063855

When developing an application where you have split out shared functionality to multiple dependent gem repositories can get cumbersome when you

  • need to edit the Gemfile in order to swap local :path sources with :git or just plain Rubygems sources,
  • then forget to bundle update,
  • wonder why your git repository is dirty and it's just the modified Gemfile and Gemfile.lock,
  • accidentally commit the Gemfile.lock with local :path sources bundled etc. etc.

So what about this strategy:

A. Create a file .Gemfile.local containing:

View Interesting I18n repositories.textile
View activerecord-3-skip_callbacks.rb
require 'active_support/basic_object'
ActiveRecord::Base.class_eval do
class WithoutCallbacks < ActiveSupport::BasicObject
def initialize(target, types)
@target = target
@types = types
end
def respond_to?(method, include_private = false)
View ruby_confs_2013.md
@svenfuchs
svenfuchs / gist:5364262
Last active Dec 16, 2015
Travis CI Office
View gist:5364262

The Travis CI office

How to get to the Travis CI office: http://goo.gl/maps/vmidH

The address is Prinzessinnenstrasse 20, on the left driveway:

View gist:1313104

Travis CI consists of two main parts right now:

  • the web app which is a regular rails app
  • workers which execute the tests

As we are moving to AMQP for communication between app and workers we want to split up the web app into

  • a rather "dumb" asset-delivery and api service and
  • a message hub that schedules jobs for the workers and consumes all the messages that come back from them (currently misleadingly called "consumer", as it consumes but also publishes)
@svenfuchs
svenfuchs / en.yml
Created Aug 4, 2011 — forked from mislav/en.yml
will_paginate i18n keys
View en.yml
en:
# ommitting the :views namespace here probably isn't an option?
will_paginate:
page_entries_info:
single_page:
zero: "No %{model} found"
one: "Displaying 1 %{model}"
other: "Displaying all %{count} %{model}"
multi_page: "Displaying %{model} %{from} - %{to} of %{total} in total"
models: