Skip to content

Instantly share code, notes, and snippets.

View elmendalerenda's full-sized avatar

Miguel Ángel Fernández elmendalerenda

View GitHub Profile
# This configuration was generated by `rubocop --auto-gen-config`
# on 2014-07-03 15:34:29 +0000 using RuboCop version 0.24.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
Style/ClassLength:
Enabled: false
Style/DotPosition:
@elmendalerenda
elmendalerenda / .gitconfig
Last active August 29, 2015 14:05 — forked from briandailey/.gitconfig
find pull request
[alias]
pr = "!f() { git log --merges --ancestry-path --oneline $1..master | grep 'pull request' | tail -n1 | awk '{ print $5 }'; }; f"
(def dd (fn [l] (fn[n] (drop n l))))
(def tails (fn [l] (map (dd l) (range 0 (count l)))))
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
@elmendalerenda
elmendalerenda / rspec_sample.rb
Last active August 26, 2016 09:58
sample for medium article
it 'calls remote service' do
expect(RemoteServices).to receive(:request_recognize)
.with('88.wav')
.and_return({result: 'ochenta y ocho'}.to_json)
result = VoiceService.recognize('88.wav')
expect(result).to eql('ochenta y ocho')
end
@elmendalerenda
elmendalerenda / minitest_sample.rb
Last active August 26, 2016 10:06
minitest sample for medium article
def test_calls_remote_service
remote_services = Minitest::Mock.new
voice_service = VoiceService.new(remote_services)
remote_services.expect :request_recognize, { result: 'ochenta y ocho' }.to_json, ['88.wav']
result = voice_service.recognize('88.wav')
assert_equal 'ochenta y ocho', result
remote_services.verify
end
require "minitest/autorun"
class TestMine < Minitest::Test
def test_1
field = '*'
expected_result = '*'
assert_equal expected_result, minesweeper(1, 1, field)
end