Skip to content

Instantly share code, notes, and snippets.

View guatajuk's full-sized avatar

Julián Alberto Gaitán Arias guatajuk

View GitHub Profile
@rob-murray
rob-murray / find_dups.rb
Last active November 8, 2024 09:21
Rails find duplicate records
columns_that_make_record_distinct = [:some_id, :another_name]
duplicate_records = Model.where.not(id: Model.select("MIN(id) as id").group(columns_that_make_record_distinct))
@hectoregm
hectoregm / gist:1401897
Created November 28, 2011 20:30
Regexp, Ruby and You

Regular Expressions: The Good Parts (Ruby Edition)

Introduction

So what are regular expressions?, Wikipedia has a nice [definition][1]:

Regular expressions provides a concise and flexible means for "matching" (specifying and recognizing) strings of text, such as particular characters, words, or patterns of characters. Abbreviations for "regular expression" include "regex" and "regexp".