Skip to content

Instantly share code, notes, and snippets.

View elmendalerenda's full-sized avatar

Miguel Ángel Fernández elmendalerenda

View GitHub Profile
require "minitest/autorun"
class TestMine < Minitest::Test
def test_1
field = '*'
expected_result = '*'
assert_equal expected_result, minesweeper(1, 1, field)
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
@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
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
(def dd (fn [l] (fn[n] (drop n l))))
(def tails (fn [l] (map (dd l) (range 0 (count l)))))
@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"
# 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:
set encoding=utf-8
set nocompatible " Must come first because it changes other options.
syntax enable " Turn on syntax highlighting.
set tabstop=2 " Global tab width.
set shiftwidth=2 " And again, related.
set expandtab " Use spaces instead of tabs
set softtabstop=2 " Makes the spaces feel like real tabs
@elmendalerenda
elmendalerenda / enc.sh
Created April 27, 2014 10:12
pgp encryption in dropbox
#decrypt
gpg -o ./Desktop/personal.tgz -d ./Dropbox/personal.tgz.gpg && cd ./Desktop/ && tar xvzf personal.tgz && rm personal.tgz && cd ..
#encrypt
cd ./Desktop/ && tar cvzf - personal/ | gpg -esr $PGP_RECIPIENT > ../Dropbox/personal.tgz.gpg
--type-add=css=.sass,.less,.scss
--type-add=ruby=.rake,.rsel,.builder,.thor
--type-add=html=.haml,.html.erb,.html.haml
--type-add=js=.js.erb,.coffee
--type-set=cucumber=.feature
--type-set=c=.c,.cpp,.ino,.pde,.h
--ignore-dir=vendor
--ignore-dir=log
--ignore-dir=tmp
--ignore-dir=doc