Skip to content

Instantly share code, notes, and snippets.

@biinari
biinari / rvm2rbenv.txt
Last active December 16, 2015 06:09 — forked from brentertz/rvm2rbenv.txt
Arch linux focussed rvm2rbenv instructions
## Prepare ###################################################################
# Remove RVM
rvm implode
# Update software for archlinux
yaourt -Syau
## Install ###################################################################
yaourt -S rbenv
@biinari
biinari / rbenv_plugins
Last active December 17, 2015 16:09
Install a few rbenv plugins to make things easier
mkdir -p ~/.rbenv/plugins
cd ~/.rbenv/plugins
git clone https://github.com/ianheggie/rbenv-binstubs.git
git clone https://github.com/sstephenson/rbenv-default-gems.git
git clone https://github.com/sstephenson/rbenv-gem-rehash.git
echo "bundler" >> ~/.rbenv/default-gems
echo "alias bundleinstall='bundle install --binstubs .bundle/bin --path vendor/bundle'" >> ~/.bashrc
@biinari
biinari / Vagrantfile
Created May 29, 2013 09:59
Set guest additions path for vagrant-vbguest plugin. ~/.vagrant.d/Vagrantfile
# Vagrant's autoloading may not have kicked in
begin
require 'vagrant-vbguest' unless defined? VagrantVbguest
require 'vagrant-vbguest/config' unless defined? VagrantVbguest::Config
VagrantVbguest::Config.iso_path = "/usr/lib/virtualbox/additions/VBoxGuestAdditions.iso"
rescue LoadError
end
@biinari
biinari / mailcatcher.conf
Created June 12, 2013 15:50
Upstart script for http://mailcatcher.me/ /etc/init/mailcatcher.conf
description "Mailcatcher"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
pre-start script
bash << "EOF"
mkdir -p /var/log/mailcatcher
@biinari
biinari / mocha_to_rspec_mocks.sed
Last active December 27, 2018 16:47
Converts mocha expectations to rspec-mocks.
s/\([^.a-zA-Z_-]\)stub\>/\1double/g
s/\([^.a-zA-Z_-]\)mock\>/\1double/g
s/\.returns\>/.and_return/g
s/\.yields\>/.and_yield/g
s/\(\S\+\)\.stubs(/allow(\1).to receive(/g
s/\(\S\+\)\.expects(/expect(\1).to receive(/g
s/at_least_once/at_least(:once)/g
s/at_most_once/at_most(:once)/g
s/\.raises\>/.and_raise/g
s/\(allow\|expect\)(\(\S\+\)\.any_instance).to receive/\1_any_instance_of(\2).to receive/g
AccessModifierIndentation:
Enabled: false
AccessorMethodName:
Enabled: false
ClassAndModuleChildren:
Exclude:
- '**/lib/client/*/concerns/**'
diff --git ext/readline/extconf.rb ext/readline/extconf.rb
index 4920137..8e81253 100644
--- ext/readline/extconf.rb
+++ ext/readline/extconf.rb
@@ -19,6 +19,10 @@ def readline.have_func(func)
return super(func, headers)
end
+def readline.have_type(type)
+ return super(type, headers)
Consuming test message fc8104a8-3b4d-4940-a26c-5f9e61cb5d4c
message(fc8104a8-3b4d-4940-a26c-5f9e61cb5d4c): error in consumer 'TestConsumer'
message(fc8104a8-3b4d-4940-a26c-5f9e61cb5d4c): TypeError - String can't be coerced into Float
backtrace:
/home/vagrant/v2_vendor/service-order/bundle/ruby/2.0.0/bundler/gems/v2-queue-b3558fd59db3/lib/fatsoma/queue/consumer.rb:87:in `*'
/home/vagrant/v2_vendor/service-order/bundle/ruby/2.0.0/bundler/gems/v2-queue-b3558fd59db3/lib/fatsoma/queue/consumer.rb:87:in `randomise_by_percent'
/home/vagrant/v2_vendor/service-order/bundle/ruby/2.0.0/bundler/gems/v2-queue-b3558fd59db3/lib/fatsoma/queue/consumer.rb:69:in `next_expiration'
/home/vagrant/v2_vendor/service-order/bundle/ruby/2.0.0/bundler/gems/v2-queue-b3558fd59db3/lib/fatsoma/queue/consumer.rb:48:in `republish'
/home/vagrant/v2_vendor/service-order/bundle/ruby/2.0.0/bundler/gems/v2-queue-b3558fd59db3/lib/fatsoma/queue/consumer.rb:33:in `rescue in process'
/home/vagrant/v2_vendor/service-order/bundle/ruby/2.0.0/bundler/gem
@biinari
biinari / AssertException.hs
Last active August 29, 2015 14:13
Tests for RNA transcription exercise from exercism.io, added error cases
module AssertException (assertException, assertErrorCall) where
import Control.Exception (ErrorCall(..), Exception, handleJust, SomeException(..))
import Control.Monad (guard)
import Test.HUnit (assertFailure)
import System.IO (hPutStrLn, stderr)
assertException :: (Exception e, Eq e) => e -> IO a -> IO ()
assertException ex action =
handleJust isWanted (const $ return ()) $ do
@biinari
biinari / leap_year.rb
Created January 26, 2015 23:37
Odd implementation of leap year logic. Spot how this could have been expressed much simpler.
class Year
def self.leap?(year)
if year % 4 == 0 || year % 400 == 0
if year % 100 == 0 && year % 400 == 0
true
elsif year % 100 == 0
false
else
true
end