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 / 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
# 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 / 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)
@willywg
willywg / rspec_model_testing_template.rb
Created September 4, 2018 15:53 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems: