Skip to content

Instantly share code, notes, and snippets.

View beatrizsmerino's full-sized avatar
🏠
Working from home

Beatriz Sopeña Merino beatrizsmerino

🏠
Working from home
View GitHub Profile
@beatrizsmerino
beatrizsmerino / index.html
Created October 5, 2019 11:20
Sample HTML5 Layout
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="description" content="Sample HTML5 Layout">
<meta name="keywords" content="keyword 1, keyword 2, keyword 3">
<meta name="author" content="Beatriz Sopeña Merino">
<meta name="copyright" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
function BrowserDetection() {
var browser;
if ((navigator.userAgent.indexOf("MSIE") != -1) || (!!document.documentMode == true)) {
browser = "IE";
} else if (navigator.userAgent.indexOf("Edge") != -1) {
browser = "Edge";
} else if (navigator.userAgent.indexOf("Chrome") != -1) {
browser = "Chrome";
} else if (navigator.userAgent.indexOf("Firefox") != -1) {
@beatrizsmerino
beatrizsmerino / clickTarget-javascript.js
Last active April 2, 2020 15:00
Check element on click
window.addEventListener("click", function (e) {
e.preventDefault();
console.dir(e.target);
});
@beatrizsmerino
beatrizsmerino / popup.js
Last active October 22, 2019 16:26
Pop up inside the html to position it above all
$(document).ready(function () {
// open popup
$(".popup__button-open").on("click", function () {
var $this = $(this),
$thisPopUp = $this.closest(".swiper-slide").find('.popup');
$thisPopUp.clone().appendTo(".global-locations").addClass("is-view");
@beatrizsmerino
beatrizsmerino / verifyNum.js
Last active March 13, 2023 23:46
Verify if it is a number
function validation(num) {
if (num == "undefined" || num == null || num == "") {
console.log("Inserta un número.");
return 0;
} else {
if (isNaN(num) && num !== "") {
console.log("Ups... " + "'" + + num + "'" + " no es un número.");
return 1;
} else {
if (num % 1 == 0) {
@beatrizsmerino
beatrizsmerino / cleanStorage.js
Created December 26, 2019 23:38
Clean the browser storage to delete the POST variables from the forms and prevent them from being resent when clicking on the button again.
if(window.history.replaceState){
window.history.replaceState(null, null, window.location.href);
}
@beatrizsmerino
beatrizsmerino / svgMe-javascriptES5.js
Last active March 13, 2023 23:46
Function 'svgMe' with jquery and vanilla javascript. This function converts an `<img>` tag, with a `.svg` extention and a class `svgMe`, into a `<svg>` tag. Example: https://codepen.io/beatrizsmerino/pen/pooMYdw
/**
* @function svgMe
* @description Version with Vanilla Javascript ES5
* Converts an `<img>` tag, with a `.svg` extention and a class `svgMe`, into a `<svg>` tag.
* @return {object} Return the file svg
*/
function svgMe() {
console.info(
"%cSvgMe__javascriptES5",
"padding: 0.2rem 0.5rem; background-color: rgb(17, 176, 200); color: #fff;"
@beatrizsmerino
beatrizsmerino / index.html
Last active February 10, 2020 15:26
Service worker
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Mi primer Service worker</title>
</head>
@beatrizsmerino
beatrizsmerino / folder-files.txt
Last active March 13, 2023 23:46
Commands Git
FOLDERS & FILES
---------------------------
-> Entrar dentro de un directorio
cd <nameFolder>
@beatrizsmerino
beatrizsmerino / _abstracts-mixins-variables-root.scss
Last active May 15, 2020 08:43
How use a variable root css in scss
// ABSTRACTS - MIXINS
// variables-root
// =================================================
// Creation of the mixin: root-prop
@mixin root-prop($prop: null, $value: null) {
@if ($prop and $value) {
#{$prop}: $value;