Skip to content

Instantly share code, notes, and snippets.

View sergixnet's full-sized avatar

Sergio Peña sergixnet

View GitHub Profile
@sergixnet
sergixnet / target-offset.css
Created January 5, 2019 09:40
How to offset anchor tag link using CSS
:target:before {
content:"";
display:block;
height:90px; /* fixed header height*/
margin:-90px 0 0; /* negative fixed header height */
}
@sergixnet
sergixnet / blueprint-on-page.yml
Last active December 18, 2018 10:28
Grav contact form validation with recaptcha and jquery.validate.js
form:
action: /
name: contact-form
classes: contact-form
template: form-messages
referesh_prevention: true
fields:
-
name: name
label: Nombre
@sergixnet
sergixnet / rename.py
Created November 6, 2018 06:17
Script to rename files of a folder
# program to rename files with slug like names
import re
import os
import shutil
FOLDER_PATH = "/the-folder-path"
def slugify(fileName):
fileName = re.sub(r'\s|_', "-", fileName).lower()
return fileName
@sergixnet
sergixnet / is-touch.js
Last active June 6, 2018 08:00
This snippet detects if current device has a touch screen
// Detect touch devices
var isTouchDevice = function isTouchDevice() {
if (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
return true;
}
return false;
}
if ( isTouchDevice()) {
document.body.classList.add('touch-device');
#!/bin/bash
# This script creates a backup of a grav Instalation
# Go to the root of the project
cd httpdocs
# Create the backup
bin/grav backup
#!/bin/bash
# This script updates GRAV and the plugins
# Go to the root of the project
cd httpdocs
# Upgrade GRAV
bin/gpm selfupgrade
#!/bin/bash
# This script updates WordPress core and database with WP-CLI
# Go to WordPress directory
cd htdocs
# Update WordPress
wp core update
#!/bin/bash
# Creates a backup of a WordPress instalation, files and database with WP-CLI
# Go to the root directory
cd htdocs
# Backup files of the root site
tar --exclude='./.git' -czvf "backup-$(date +%Y%m%d%H%M%S).tar.gz" .

Nmap commands

See all open ports of a host

$ nmap thehost.com

See all the open ports with service versions