Skip to content

Instantly share code, notes, and snippets.


William Wong Garay willywg

View GitHub Profile
willywg / form.html
Created Jul 1, 2019
Prevent multiple submits when clicked a submit button
View form.html
<form action='/'>
<button class="prevent-multiple-submit" type="submit">Create</button>
willywg /
Last active Apr 25, 2019
How create an admistrate dashboard with a moduled model
  1. If our model is Faq::UserType, then we generates the dashboard with:

rails generate administrate:dashboard faq/user_type

This generates:

Running via Spring preloader in process 21074
      create  app/dashboards/user_type_dashboard.rb
      create  app/controllers/admin/user_types_controller.rb
willywg /
Created Aug 9, 2011
devise I18n file in spanish for devise 1.4.2
# Additional translations at
# Translation by William Wong Garay (willywg)
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 / rspec_model_testing_template.rb
Created Sep 4, 2018 — forked from kyletcarlson/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…
View rspec_model_testing_template.rb
# 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:
willywg / image_magick_install_centos_6
Last active Jul 28, 2018
Instalando ImageMagick y rmagick en Centos 6
View image_magick_install_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
View Recovery-OSX-USER
1. Iniciar clover con opcion -s en el booteo (borrar cualquier otra opcion presente). Esto inciiará en Single-User mode
2. En terminal correr mount -uw /
3. Eliminar comprobador de cuenta nueva en Mac: rm /var/db/.AppleSetupDone
4. reboot
5. Crear un usuario nuevo (no usar el nombre del mismo usuario a recuperar)
6. Al inicar la cuenta nueva (nuevo admin) en prefeencias crear un usuario con el mismo nombre, elegir usar la carpeta existente
7. Cambiar a la cuenta del usuario recuperado dos veces. Pedira recuperar algunos accesos.
8. Resolver permisos: sudo chown -R willywg:admin /usr/local/var/
willywg / _flash_messages.html.slim
Created May 10, 2018
Rails flash messages helper for bootstrap 4 with slim
View _flash_messages.html.slim
- flash.each do |type, msg|
div class=("alert #{bootstrap_class_for_flash(type)} alert-dismissable fade show")
= msg
button.close data-dismiss="alert" &times;
willywg /
Last active Jul 13, 2017
Add Bulma Saas to Nuxt via npm

Add sass pre-procesor:

yarn add node-sass sass-loader -D

Add bulma

yarn add bulma
willywg / devise_helper.rb
Last active Nov 5, 2016 — forked from seyhunak/devise_helper.rb
Devise Error Messages with Bootstrap 3 style
View devise_helper.rb
# /app/helpers/devise_helper.rb
module DeviseHelper
def devise_error_messages!
return '' if resource.errors.empty?
messages = { |msg| content_tag(:li, msg) }.join
sentence = I18n.t('errors.messages.not_saved',
count: resource.errors.count,
resource: resource.class.model_name.human.downcase)
# Additional translations at
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."