Skip to content

Instantly share code, notes, and snippets.

@febstarer
febstarer / composer.json
Last active November 1, 2018 13:46
Drupal composer
### INSTALL
composer create-project drupal-composer/drupal-project:8.x-dev httpdocs --stability dev --no-interaction
### UPDATE
composer update drupal/core webflo/drupal-core-require-dev --with-dependencies
cd web
drush updb
drush cex
drush cr
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "[FULL_PATH]/httpdocs"
ServerName www.[DOMAIN].loc
ServerAlias www.[DOMAIN].loc
ErrorLog "[FULL_PATH]/logs/error.log"
CustomLog "[FULL_PATH]/logs/access.log" common
<Directory "[FULL_PATH]/httpdocs">
AllowOverride All
Order allow,deny
@febstarer
febstarer / OSX MYSQL error: The server quit without updating PID file
Created April 17, 2018 12:14
OSX MYSQL error: The server quit without updating PID file
sudo su
cd /usr/local/var/mysql
rm *.err
chown -R febstarer:admin .
@febstarer
febstarer / OSX Bash
Last active November 1, 2018 13:46
OSX Bash
# apache con brew
sudo brew services restart httpd
sudo vim /usr/local/etc/httpd/extra/httpd-vhosts.conf
sudo vim /usr/local/etc/httpd/httpd.conf
brew unlink [email protected]
brew install [email protected]
brew unlink [email protected] && brew link --force --overwrite [email protected]
brew link [email protected]
# brew operate with services
@febstarer
febstarer / UNIX BASH: utilities
Last active April 17, 2018 12:15
BASH: utilities
# update db for locate
sudo updatedb
locate XXX
# distro infos
lsb_release -a
# espacio disco
df -h
@febstarer
febstarer / BASH: Update PHP to PHP7
Last active February 23, 2018 10:15
BASH: Update PHP to PHP7
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
# PHP 7.0
sudo apt-get install php7.0 php7.0-mysql php7.0-fpm php7.0-common php7.0-cli php7.0-mbstring php7.0-gd php7.0-intl php7.0-xml php7.0-mcrypt php7.0-zip php7.0-curl libapache2-mod-php7.0
# PHP 7.1
sudo apt-get install php7.1 php7.1-mysql php7.1-fpm php7.1-common php7.1-cli php7.1-mbstring php7.1-gd php7.1-intl php7.1-xml php7.1-mcrypt php7.1-zip php7.1-curl libapache2-mod-php7.1
# Switch between versions (fpm)
@febstarer
febstarer / VAGRANT: Virtual machine already exists
Last active February 22, 2018 10:11
VAGRANT: Virtual machine already exists
Error:
"A VirtualBox machine with the name 'XXX' already exists.
Please use another name or delete the machine with the existing
name, and try again."
$ vboxmanage list vms
"my-vm" {c700b8b6-b766-4638-871b-736b44b7db18}
Copy the ID of the desired VM (the c700…db18 string) into the contents of ~/.vagrant/machines/default/virtualbox/id.
Save the file then run vagrant up to get the vm working without having to destroy it.
@febstarer
febstarer / VAGRANT: ScotchBox para Drupal
Last active May 8, 2018 08:57
Vagrant con ScotchBox para Drupal
############
### SCOTCHBOX php7 o php5.6
############
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "scotch/box"
# Optional: version 2.5 con php5.6
#config.vm.box_version = "2.5"
config.vm.network "private_network", ip: "[IP]"
@febstarer
febstarer / convertolabels.js
Last active April 5, 2022 07:04
JS: Convert labels to placeholders
$("form :input, form textarea, form select").each(function(index, elem) {
var eId = $(elem).attr("id");
if(eId && (label = $(elem).parents("form").find("label[for="+eId+"]")).length == 1){
if($(elem).prop('tagName') == 'SELECT'){
// if it's a dropdown, change the first item ('All') to be the label
$(elem).find('option:first').text('- '+$(label).text()+' -');
}else{
if ($(elem).is(':checkbox') || $(elem).is(':radio')) {
// if it's a checkbox or radio, don't change anything
@febstarer
febstarer / DRUPAL: show errors
Last active February 22, 2018 10:11
DRUPAL: show errors
error_reporting(E_ALL);
$conf['error_level'] = 2;
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);