Skip to content

Instantly share code, notes, and snippets.

Avatar

Juan F. Pérez jguitar

  • Barkibu
  • Valencia, Spain
View GitHub Profile
@jguitar
jguitar / any_sample_spec.rb
Created Aug 23, 2018
Compare long strings with RSpec and see differences in output
View any_sample_spec.rb
describe 'whatever' do
def compare_strings(query, result)
count = (query.length / 100) + 1
count.times do |i|
min = (i - 1) * 100
max = i * 100
expect(query[min..max]).to eq result[min..max]
end
end
end
@jguitar
jguitar / print_count.rb
Created Jun 18, 2018
Count all Rails models
View print_count.rb
class PrintCount
def diff
before = count_all_models_with_table
after = if block_given?
yield
count_all_models_with_table
else
Hash.new(0)
end
print_diff(before, after)
View 0-title.markdown

Recopilación de información sobre

Procesamiento del lenguaje natural (PLN) y Natural Language Processing (NLP)

Machine Learning (ML)

@jguitar
jguitar / less_code.markdown
Last active Aug 29, 2015
join words with commas and a final connector
View less_code.markdown

all samples with I18n.locale = :es

before

brew code, a lot of possible errors

def join_items(collection)
  return collection.first if collection.size == 1
 
View git-sequences.md

Git

Finding a delete file in history

Find the file_path exactly
git log --diff-filter=D --summary