Skip to content

Instantly share code, notes, and snippets.

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

William Wong Garay willywg

🏠
Working from home
View GitHub Profile
@willywg
willywg / rails_2.3.8_to_3.1.txt
Created August 4, 2011 03:22
Actulizando app Rails 2.3.8 a Rails 3.1
Estado inicial de app:
* Ruby 1.8.7
* Rails 2.3.8
---------
Pasos:
1. Instalamos Rails 2.3.12: gem install rails -v=2.3.12
2. Instalamos con RVM Ruby 1.9.2
3. Pasar la app a la version 2.3.x mas reciente. A la fecha (3/8/2011) es la 2.3.11. Para esto cambiamos en config/environment.rb de RAILS_GEM_VERSION = '2.3.8' a RAILS_GEM_VERSION = '2.3.12'
4. Corremos el server para ver posibles problemas. (Deprecated functions por ejemplo) y hacemios uso de google para darles una rapida solucion.
@willywg
willywg / devise.es.yml
Created August 9, 2011 12:38
devise I18n file in spanish for devise 1.4.2
# Additional translations at http://github.com/plataformatec/devise/wiki/I18n
# Translation by William Wong Garay (willywg) https://github.com/willywg
es:
errors:
messages:
expired: "ha expirado, por favor solicita una nueva"
not_found: "no se encontró"
already_confirmed: "ya fue confirmado, por favor intenta iniciar sesión"
not_locked: "no estaba bloqueado"
@willywg
willywg / UserMailer.rb
Created August 21, 2011 17:20
Mass password reset and email notification for Devise 1.4.2 with Rails 3.x
# Send password reset notification
# path: app/mailers/user_mailer.rb
class UserMailer < ActionMailer::Base
default :from => "[email protected]"
def password_reset(user, password)
@user = user
@password = password
mail(:to => user.email,
:subject => 'Password Reset Notification')
@willywg
willywg / tem.rb
Created December 29, 2011 15:01
Calcula TEM de TEA
def calcular_tem(tea)
(((1 + (tea/100))**(1.0/12.0)) - 1) * 100
end
@willywg
willywg / image_magick_install_centos_6
Last active July 28, 2018 13:37
Instalando ImageMagick y rmagick en Centos 6
1. Desinstalar todo rastro de ImageMagick e ImageMagik-devel
sudo yum remove ImageMagick
sudo yum remove ImageMagick-devel
2. Instalar complementos previos:
sudo yum install tcl-devel libpng-devel libjpeg-devel ghostscript-devel bzip2-devel freetype-devel libtiff-devel
3. Bajarse el ImageMagick desde las fuentes:
mkdir ~/sources
cd ~/sources
# Additional translations at 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 indentificado."
send_instructions: "Recibirás un correo electrónico en unos minutos con instrucciones sobre cómo reestablecer 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:
@willywg
willywg / ping.rb
Created November 24, 2013 06:00
Ping Web. Connect Ruby with Arduino by Serial Port
require 'serialport'
require 'net/ping'
website = 'http://turismoi.pek'
#this *will* be different for you
#You need to find out what port your arduino is on
#and also what the corresponding file is on /dev
#You can do this by looking at the bottom right of the Arduino
#environment which tells you what the path.
@willywg
willywg / en.js
Created May 17, 2015 02:55
BC Leveling Calculato English Lang
{
'LEVELING_TITLE': 'BC Leveling Calculator',
'MONSTER_FOR_LEVELING': 'Monster for leveling',
'SPECIAL': 'Special',
'CANDY': 'Candy',
'CRYSTAL': 'Crystal',
'RARE': 'Rare',
'SUPER': 'Super',
'ULTRA': 'Ultra',
'EPIC': 'Epic',
@willywg
willywg / gist:31f38a24afed0199eaf6
Created February 5, 2016 14:34 — forked from tamoyal/gist:10441108
Create super user and database user in Mongo 2.6
# Create your superuser
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
# Alias for convenience (optional and at your own risk)
$ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile
$ source ~/.bash_profile
@willywg
willywg / devise_helper.rb
Last active November 5, 2016 15:46 — forked from seyhunak/devise_helper.rb
Devise Error Messages with Bootstrap 3 style
# /app/helpers/devise_helper.rb
module DeviseHelper
def devise_error_messages!
return '' if resource.errors.empty?
messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
sentence = I18n.t('errors.messages.not_saved',
count: resource.errors.count,
resource: resource.class.model_name.human.downcase)