Skip to content

Instantly share code, notes, and snippets.

unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'rack', github: 'rack/rack'
gem 'sqlite3'
GEMFILE
system 'bundle'

Simplistic Full-Text Search With Redis's Sorted Sets

Howto

git clone git://gist.github.com/923934.git redisearch

cd redisearch
# Outputs this at warn log level:
# 1.2.3.4 GET /path 200 OK BlahController#action HTML 938.2 (DB 11.8, View 719.7) {params} {optional params from flash[:log]}
#
# Save as config/initializers/oneline_detailed_logging.rb. Consider
# decreasing the log level from "info" to "warn" (in production.rb) so
# the one-line log message replaces the standard request logs.
# override process_action to add 2 things to the payload:
# - remote IP
unless File.exists?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', '4.0.0'
gem 'sqlite3'
GEMFILE
system 'bundle'
end
require 'openssl'
require 'digest/sha1'
require 'base64'
require 'json'
def go_demo!
key = Digest::SHA1.hexdigest("clave1")[0..15] # 16bytes => 128bits
iv = 'clave2 con chicha'[0..15] # 16bytes forced
data = { esto: 'es', un: 'hash', en: 'ruby' }
# Traducciones adicionales en https://github.com/plataformatec/devise/wiki/I18n
es:
devise:
confirmations:
confirmed: "Tu cuenta ya ha sido confirmada."
confirmed_and_signed_in: "Tu cuenta ya ha sido confirmada. Has sido identificado."
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."
failure:
@chipairon
chipairon / gist:7625777
Last active December 29, 2015 05:59 — forked from chen206/gist:4030441
Install Postgres 9.2 on a clean Ubuntu 12.04
#!/bin/bash
#
# Install Postgres 9.2 on a clean Ubuntu 12.04
"""
LC_ALL issue
comment out the AcceptEnv LANG LC_* line in the remote /etc/ssh/sshd_config file.
sudo apt-get install language-pack-en-base
sudo dpkg-reconfigure locales
comment out the SendEnv LANG LC_* line in the local /etc/ssh/ssh_config file.