Navigation Menu

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 / form.html
Created July 1, 2019 17:33
Prevent multiple submits when clicked a submit button
<form action='/'>
<button class="prevent-multiple-submit" type="submit">Create</button>
</form>
@willywg
willywg / administrate_dashboard_to_moduled_model.md
Last active April 25, 2019 15:08
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
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 / 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:
@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
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/
Fuente:
@willywg
willywg / _flash_messages.html.slim
Created May 10, 2018 21:06
Rails flash messages helper for bootstrap 4 with 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
willywg / README.md
Last active July 13, 2017 22:40
Add Bulma Saas to Nuxt via npm

Add sass pre-procesor:

yarn add node-sass sass-loader -D

Add bulma

yarn add bulma
@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)
# 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: