Skip to content

Instantly share code, notes, and snippets.

View noniq's full-sized avatar

Stefan Daschek noniq

View GitHub Profile
@steve9001
steve9001 / application.rb
Created December 7, 2011 16:18
Rails middleware to provide information about errors during requests
module MyApp
class Application < Rails::Application
if Rails.env == 'test'
require 'diagnostic'
config.middleware.use(MyApp::DiagnosticMiddleware)
end
end
end
@mattbrictson
mattbrictson / Gemfile
Created January 26, 2012 23:02
Install Compass in Rails 3.1/3.2
group :assets do
gem 'compass-rails','~> 1.0.0.rc.2'
gem 'compass-colors'
gem 'sassy-buttons'
gem 'sass-rails', '~> 3.2.3'
# non-compass gems omitted for brevity
end
@myronmarston
myronmarston / crazy_ruby_bug.md
Last active December 14, 2015 17:38
The craziest ruby bug I've ever seen. I don't understand it. At all.

I've discovered a crazy bug that's really confusing me. I'm curious to hear if anyone can explain it.

Here's some code in foo.rb:

class Superclass
  unless ENV['NORMAL_METHOD_DEF']
    define_method :regex do
      /^(\d)$/
    end
<script>
n = prompt().split("");
c = "q=n[0];w=n[1];r[x=n.join('')*1] || e(y[(x+'').length])";
t = "tausend"; h = "hundert";j='zig';
y=[,,"w==0?r[q]+j:(q==1?r[w]+r[10]:r[w]+'und'+(i[q]||r[q]+j))","n.shift();r[q]+h+e(c)","n=n.slice(-3);r[q]+t+e(c)","k=n.splice(2);u=e(c);n=k;u+t+e(c)","e(y[5].replace(2,3))"];
r="0ein0zwei0drei0vier0fuenf0sechs0sieben0acht0neun0zehn0elf0zwölf".split(0);
r[20]="zwanzig";r[30]="dreißig";i=[,,r[20],r[30]];
alert((e = eval)(c).replace(/(en|s)z/,'z').replace(/in$/,'$1s'))
</script>
@bhaberer
bhaberer / submodule_strategy.rb
Last active January 29, 2019 20:13 — forked from stevenscg/submodule_strategy.rb
Capistrano 3.1.x Strategy to deploy git projects with submodules.
# Usage:
# 1. Drop this file into lib/capistrano/submodule_strategy.rb
# 2. Add the following to your Capfile:
# require 'capistrano/git'
# require './lib/capistrano/submodule_strategy'
# 3. Add the following to your config/deploy.rb
# set :git_strategy, SubmoduleStrategy
module SubmoduleStrategy
# do all the things a normal capistrano git session would do