Skip to content

Instantly share code, notes, and snippets.

View raulmoyareyes's full-sized avatar
💻
Programming!

Raúl Moya Reyes raulmoyareyes

💻
Programming!
View GitHub Profile
@raulmoyareyes
raulmoyareyes / wrong-ocp.js
Created July 29, 2018 15:37
[ Wrong ] - Open / Closed Principle
class Pdf {
constructor(name, size) {
this.name = name;
this.size = size;
}
// ...
}
class Png {
constructor(name) {
@raulmoyareyes
raulmoyareyes / srp.js
Created July 29, 2018 15:30
Single Responsability Principle
class UserAuth {
constructor(user) {
this.user = user;
}
verifyCredentials() {
// ...
}
}
@raulmoyareyes
raulmoyareyes / wrong-srp.js
Last active July 29, 2018 15:29
[ Wrong ] - Single Responsability Principle
class UserSettings {
constructor(user) {
this.user = user;
}
changeSettings(settings) {
if (this.verifyCredentials()) {
// ...
}
}
@raulmoyareyes
raulmoyareyes / Calisthenics.md
Created April 23, 2018 14:11 — forked from bobuss/Calisthenics.md
The 9 Rules of Object Calisthenics

Object Calisthenics outlines 9 basic rules to apply when performing the exercise:

  • One level of indentation per method.
  • Don't use the ELSE keyword.
  • Wrap all primitives and Strings in classes.
  • First class collections.
  • One dot per line.
  • Don't abbreviate.
  • Keep all classes less than 50 lines.
  • No classes with more than two instance variables.
@raulmoyareyes
raulmoyareyes / what-forces-layout.md
Created June 30, 2017 07:09 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@raulmoyareyes
raulmoyareyes / useful-commands.txt
Created January 15, 2017 11:57
Useful commands for apache log and folders.
# IPs distintas y peticiones
cat access.log | awk '{print $1}' | sort -n | uniq -c | sort -nr | head -30
# Peticiones al dia
zcat access.log-*.gz | awk '{print substr($4, 2, 11)}' | sort -n | uniq -c
# Total de peticiones sumadas de todos los dias
zcat access.log-*.gz | awk '{print substr($4, 2, 11)}' | sort -n | uniq -c awk '{ sum += $1 } END { print sum }'
# Numero de peticiones a paginas (sin contar imagenes etc)
@raulmoyareyes
raulmoyareyes / .htaccess-mod_headers
Created June 1, 2016 15:04 — forked from hans2103/.htaccess-mod_headers
.htaccess rules to set cache control.
<IfModule mod_headers.c>
Header set Connection keep-alive
# Cache-control headers
# 2 HOURS
#<filesMatch "*">
Header set Cache-Control "max-age=7200, must-revalidate"
#</filesMatch>
# 480 weeks - 290304000
Información del dispositivo
*#06# : Visualización del número IMEI del dispositivo
*#*#1111#*#* : Información sobre la versión de software FTA
*#*#2222#*#* : Información sobre la versión del hardware FTA
*#*#1234#*#* : Información sobre la versión de software PDA y de firmware
*#*#232337#*#* : Muestra la dirección Bluetooth del smartphone
*#*#232338#*#* : Muestra la dirección MAC del la tarjeta WiFi del dispositivo
*#*#2663#*#* : Visualiza la versión de la pantalla táctil del smartphone
*#*#3264#*#* : Muestra que versión de memoria RAM está disponible en el smartphone o la tablet
@raulmoyareyes
raulmoyareyes / httpResponse.md
Last active November 21, 2015 20:40
HTTP Response codes

Para cada error que aparece en la web hay un código de estado HTTP enviado por el servidor web. Los códigos de estado vienen en el formato de números con 3 dígitos. El primer dígito representa la clase del código de estado:

  • 1XX: Informativo - Solicitud recibida, proceso continuo.

  • 2XX: Éxito - La acción fue recibida con éxito, comprendida y aceptado.

  • 3XX: Redirección - Hay que tomar acciones complementarias con el fin de completar la solicitud.

  • 4XX: Error del lado del cliente - La solicitud contiene una sintaxis incorrecta o no puede cumplirse.

  • 400 Bad Request
@raulmoyareyes
raulmoyareyes / networkCommand.md
Last active March 26, 2025 18:05
Linux command to check Internet connection speed.

# View public IP

  • curl -s checkip.dyndns.org | sed 's#.Address: (.)</b.*#\1#'
  • wget -qO - icanhazip.com
  • curl ifconfig.me
  • curl ident.me
  • dig +short myip.opendns.com @resolver1.opendns.com
  • lynx -dump ifconfig.me | grep 'IP Address'
  • curl ipecho.net/plain
  • curl bot.whatismyipaddress.com
  • curl ipinfo.io