Skip to content

Instantly share code, notes, and snippets.


William Wong Garay willywg

View GitHub Profile
willywg / UserMailer.rb
Created Aug 21, 2011
Mass password reset and email notification for Devise 1.4.2 with Rails 3.x
View UserMailer.rb
# Send password reset notification
# path: app/mailers/user_mailer.rb
class UserMailer < ActionMailer::Base
default :from => ""
def password_reset(user, password)
@user = user
@password = password
mail(:to =>,
:subject => 'Password Reset Notification')
willywg / gist:31f38a24afed0199eaf6
Created Feb 5, 2016 — forked from tamoyal/gist:10441108
Create super user and database user in Mongo 2.6
View gist:31f38a24afed0199eaf6
# 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 / ping.rb
Created Nov 24, 2013
Ping Web. Connect Ruby with Arduino by Serial Port
View ping.rb
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 / tem.rb
Created Dec 29, 2011
Calcula TEM de TEA
View tem.rb
def calcular_tem(tea)
(((1 + (tea/100))**(1.0/12.0)) - 1) * 100
willywg / rails_2.3.8_to_3.1.txt
Created Aug 4, 2011
Actulizando app Rails 2.3.8 a Rails 3.1
View rails_2.3.8_to_3.1.txt
Estado inicial de app:
* Ruby 1.8.7
* Rails 2.3.8
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 / en.js
Created May 17, 2015
BC Leveling Calculato English Lang
View en.js
'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',