Skip to content

Instantly share code, notes, and snippets.

View seguelador's full-sized avatar
🏠
Working from home

Matias Seguel seguelador

🏠
Working from home
  • Mercado Libre
  • Chile
View GitHub Profile
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
es-CL:
devise:
confirmations:
confirmed: "Tu cuenta ya ha sido confirmada."
confirmed_and_signed_in: "Tu cuenta ya ha sido confirmada. Has sido identificado automáticamente."
send_instructions: "Recibirás un correo electrónico en unos minutos con instrucciones sobre cómo restablecer tu contraseña."
send_paranoid_instructions: "Si tu correo electrónico existe en nuestra base de datos recibirás un correo electrónico en unos minutos con instrucciones sobre cómo reiniciar tu contraseña."
new:
resend_confirmation_instructions: Reenviar instrucciones de confirmación

Powerlevel10k can generate the same prompt as Pure.

pure

Installation

git clone https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>! ~/.zshrc
@seguelador
seguelador / ActiveRecord_transaction.rb
Created August 20, 2020 23:32
Ejemplo de como utilizar un Active Record Transaction
# Save scheduling distribution for a campaign
def self.save_distribution params
transaction_ok = true
begin
Scheduling.transaction do
# Get campaign and company working week days
campaign = Campaign.find(params[:campaign][:id])
company_wwd = campaign.company.working_week_days
# Si no eligió ningún día laboral, se distribuye a cualquier día
company_wwd = Hash[WORKING_WEEK_DAYS.collect { |wd| [wd, true] }] if company_wwd.values.uniq.length == 1 && !company_wwd.values.uniq.first
@seguelador
seguelador / change_wordpress_domain.md
Created August 21, 2018 11:26 — forked from jaircuevajunior/change_wordpress_domain.md
Change/Migrate wordpress domain in MySQL

Find/Replace within dump method

This is a very simple method, and for me (as a SysAdmin) it's very practical as I usually make things through SSH terminal.

It's important to say that everything (including text inside posts) that matches the find string WILL BE REPLACED!

For me it's never been a problem so far, but one never knows

First we generate the dump itself, for example:

mysqldump -umyuser -pmypass mydatabase > mydumpfile.sql
@seguelador
seguelador / iterm2-solarized.md
Created April 24, 2018 08:19 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@seguelador
seguelador / README-Template.md
Created April 20, 2018 07:49 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

# EvilCorp terminal
PROMPT='%{$fg_bold[blue]%} s3gu3l4d0r##$:%d: %{$reset_color%} $(git_prompt_info) '
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
@seguelador
seguelador / active_record_extension.rb
Created September 8, 2017 14:12
Active Record Union Scopes
# from https://stackoverflow.com/questions/6686920/activerecord-query-union
# lib/active_record_extension.rb
module ActiveRecordExtension
extend ActiveSupport::Concern
class_methods do
def union_scope(*scopes)
id_column = "#{table_name}.#{primary_key}"
sub_query = scopes.map { |s| s.select(id_column).to_sql }.join(" UNION ")
where "#{id_column} IN (#{sub_query})"
@seguelador
seguelador / _products.html.erb
Last active August 30, 2017 17:57
Will Paginate Boostrap with Ajax
<% @products.each do |product| %>
<span> <%= product.title %> </span>
<span> <%= product.price %> </span>
<% end %>
<%= will_paginate @products, renderer: BootstrapPagination::Rails %>
<%#= will_paginate @products, renderer: BootstrapPagination::Rails, :params => { :controller => "optional controller", :action => "optional action" } %>
@seguelador
seguelador / postgis.rb
Last active July 14, 2017 13:43
All points inside a circle POSTGIS Rails
Crea un circulo en base a un punto de 2km
ActiveRecord::Base.connection.execute("SELECT ST_Buffer(ST_GeomFromText('POINT(100 90)'), 2000, 'quad_segs=3')")
###########################
Trae todos los customers ordenados segun distancias, tomando la distancia mas cercana primero respecto al punto
ActiveRecord::Base.connection.execute("SELECT * FROM customers ORDER BY customers.location <-> 'POINT(-70 -33)'")
###########################