Skip to content

Instantly share code, notes, and snippets.

@luisfc
luisfc / Install MyCLI
Created June 13, 2017 20:04
Install MyCLI
MyCLI is a command line interface for MySQL, MariaDB, and Percona with auto-completion and syntax highlighting.
sudo apt-get install mycli
Used examples:
$ mycli local_database
$ mycli -h localhost -u root
@luisfc
luisfc / __INDEX.txt
Created July 19, 2017 00:34 — forked from facine/__INDEX.txt
Drupal 8 - Examples
# Taxonomy terms:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_taxonomy_term-php
# Menu links:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_menu_link-php
# File items:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_file-php
# Nodes:
@luisfc
luisfc / install nodejs, npm and gulp
Last active October 3, 2020 16:37
Install nodejs, npm and gulp ubuntu 16.04
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
## Use n module from npm in order to upgrade node
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
@luisfc
luisfc / ContactForm-basic.php
Created June 18, 2018 01:24 — forked from WengerK/ContactForm-basic.php
Drupal 8 — Inline validation in forms
<?php
/**
* @file
* Contains \Drupal\my_contact\Form\ContactForm.
*/
namespace Drupal\my_contact\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
@luisfc
luisfc / LICENCE SUBLIME TEXT
Created July 8, 2018 22:40
Sublime Text 3 Serial key build is 3176
## Sublime Text 3 Serial key build is 3176
> * Added these lines into /etc/hosts
127.0.0.1 www.sublimetext.com
127.0.0.1 license.sublimehq.com
> * Used the license key
----- BEGIN LICENSE -----
@luisfc
luisfc / Upgrade Virtualbox 5.1 to 5.2 on Ubuntu
Last active October 18, 2018 06:37
Upgrade Virtualbox 5.1 to 5.2 on Ubuntu
How to install VirtualBox 5.2 on Ubuntu
#Open a terminal "Ctrl + Alt + t" and remove Virtualbox 5.1.
sudo apt remove virtualbox virtualbox-5.1
#Debian-based Linux distributions
#Add a new repository
#According of the distribution, replace '<mydist>' with 'artful', 'zesty', 'yakkety', 'xenial', 'trusty', 'stretch', 'jessie', or 'wheezy' (older versions of VirtualBox supported different distributions)
sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian <mydist> contrib" >> /etc/apt/sources.list.d/virtualbox.list'
or add in /etc/apt/sources.list.
@luisfc
luisfc / Install Vagrant on Ubuntu 16.04 LTS
Created October 18, 2018 07:02
Install Vagrant on Ubuntu 16.04 LTS (Xenial Xerus)
# Remove the older version of vagrant.
sudo apt-get remove --auto-remove vagrant
rm -r ~/.vagrant.d
#Download Vagrant package and install it manually.
#Vagrant download page provides the latest version of Vagrant
https://www.vagrantup.com/downloads.html
#This example used debian package x86_64
1. wget https://releases.hashicorp.com/vagrant/2.2.0/vagrant_2.2.0_x86_64.deb
#Nginx.conf file
server {
listen 80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name site.local;
ssl_certificate /etc/ssl/certs/site.local.crt;
ssl_certificate_key /etc/ssl/private/site.local.key;
@luisfc
luisfc / Remove all images with JavaScript
Last active August 25, 2022 21:03
Remove all images with JavaScript
//#1
var images = document.getElementsByTagName('img');
var l = images.length;
for (var i = 0; i < l; i++) {
images[0].parentNode.removeChild(images[0]);
}
//#2
for (var i= document.images.length; i-->0;)
document.images[i].parentNode.removeChild(document.images[i]);
@luisfc
luisfc / mycustom_theme.theme
Created January 14, 2019 20:58
mycustom_theme d8
<?php
/**
* @file
* Functions to support theming in the Pattern Lab theme.
*/
function mycustom_theme_preprocess_page(array &$variables) {
// Prepare the intro values
$variables['intro_logo'] = file_url_transform_relative(file_create_url(theme_get_setting('intro_logo', 'mycustom_theme')));