Skip to content

Instantly share code, notes, and snippets.

View RiverMartinezG's full-sized avatar

River Antonio Martínez González RiverMartinezG

View GitHub Profile
@RiverMartinezG
RiverMartinezG / object-desctructuriong.js
Created August 29, 2023 03:07
[Javascript Object destructuring] Desctructuring a multilevel object in javascript #javascript
const {
firstLevel: {
secondLevel: { attributeOriginalName: renameAtributte = 'setDefaultValue'},
anotherSecondLevel: anotherAttributeOriginal_name
}
} = mainObjectOrFunction();
@RiverMartinezG
RiverMartinezG / index.js
Created August 17, 2023 17:15
[Correct way detect window resize] Don't use innerWidth, instead use matchmedia for detect media queries #javascript
// don't do this, it is very costly
window.addEventListener('resize', () => {
if (window.innerWidth > 720) {
showElementDesktop();
}
});
// use the media queries api
const desktopMediaQuery = window.matchmedia('(min-width: 720px)');
@RiverMartinezG
RiverMartinezG / MySQL-Workbench-patch.txt
Last active November 7, 2015 05:02
MySQL Workbench - Bug Fix It - No show Row and Columns - Ubuntu 14.04 - Elementary Os Freya
If you want to patch and build mysql-workbench yourself, you can get the source from for 6.2.3 from http://dev.mysql.com/downloads/file.php?id=453799. From the directory you downloaded it to, do:
tar xvf mysql-workbench-community-6.2.3-src.tar.gz
cd mysql-workbench-community-6.2.3-src
wget -O patch-glib.diff http://bugs.mysql.com/file.php?id=21874&bug_id=74147
patch -p0 < patch-glib.diff
sudo apt-get build-dep mysql-workbench
sudo apt-get install libgdal-dev
cd build
cmake .. -DBUILD_CONFIG=mysql_release
@RiverMartinezG
RiverMartinezG / Redirect WWW to non WWW
Created February 20, 2015 15:55
301 Redirect Website
Found the following information here: http://stackoverflow.com/questions/14245668/redirect-www-to-non-www-or-the-other-way-around
For Apache, copy these rules in the .htaccess file located in the wwwroot directory: (Choose only one!)
#########################
# redirect no-www to www
#########################
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(?!www\.)(.+) [NC]