Skip to content

Instantly share code, notes, and snippets.

View jguitar's full-sized avatar

Juan Fco. Pérez jguitar

  • Barkibu
  • Valencia, Spain
View GitHub Profile
@jguitar
jguitar / any_sample_spec.rb
Created August 23, 2018 08:09
Compare long strings with RSpec and see differences in output
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 June 18, 2018 15:58
Count all Rails models
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)

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 August 29, 2015 14:19
join words with commas and a final connector

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
 
@jguitar
jguitar / design-patterns-cheatsheet.markdown
Last active March 19, 2021 05:56
Desing Patterns Cheat Sheet
@jguitar
jguitar / git-sequences.md
Last active December 11, 2015 04:48
Git sequences

Git

Finding a delete file in history

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