Skip to content

Instantly share code, notes, and snippets.

View keopx's full-sized avatar

Ruben Egiguren keopx

View GitHub Profile
@juampynr
juampynr / README.md
Created May 31, 2016 09:35
Run Drupal 8 web tests without installing Drupal
  1. Create a MySQL database.
  2. Create a user that has access to that database.
  3. Make sure that you have the PDO_MySQL PHP library (otherwise you will get an error because it is missing).
  4. Run the following script.
  5. Once tests complete, we need to stop PHP's web server.

Note: there seem to be some issues with PHP's built-in web server. Please report them here https://www.drupal.org/node/1543858.

@juampynr
juampynr / README.md
Last active August 6, 2019 08:46
Sample Guzzle 6 request to Drupal 8 using OAuth 1

This script helps you to test OAuth-signed requests against Drupal 8.

First, make sure that Drupal has been configured by following the steps at https://www.drupal.org/node/2110825. Then install this script with these steps:

  1. Clone this gist.
  2. Run composer.install.
  3. Open oauth_request.php and fill out your consumer_key and consumer_secret. Then Adjust base_uri.
  4. Execute the script with php oauth_request.php.
@keopx
keopx / phpstormdebug.sh
Created November 4, 2015 08:07
PHPSTORM debug
#!/bin/sh
export XDEBUG_CONFIG="idekey=PHPSTORM"
php bin/phpspec run

Download DrupalConsole

curl https://drupalconsole.com/installer -L -o drupal.phar

Make DrupalConsole globaly accesible

$ mv console.phar /usr/local/bin/drupal
@mortendk
mortendk / template-choser.md
Last active April 29, 2016 09:32
Drupal8 concept for selecting templates form the ui

template chooser

Drupal8 is pretty awesome, but its a problem that you cant choose fromt the ui which template to use. Sure you can overwrite whats there (node--article.html.twig) but that dont give the end user a chance to later change in the site & can end up in even more templates & clutter.

template suggestions

Make it easy to provide a template suggestion for entities, blocks, pages, nodes, fields, menues, username, everything that have a template you should be able to give a suggestion.

class selector

A prepopulated list of classes that can be selected for a template.

The modules userbase is sitebuilders & themes that wants to provide variations for a site, developers dont have to provide templates after a site is build, and can rely on the theme to provide all the variations.

@facine
facine / __INDEX.txt
Last active August 6, 2023 15:33
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:
@keopx
keopx / drupal8_reinstall.sh
Last active April 25, 2017 17:18
Drupal 8 reinstall site script
#!/bin/bash
cd drupal
sudo rm -fr vendor
composer install
sudo chmod 777 sites/default
cd sites/default
rm -fr settings.php services.yml
# for developers only (sets up some dev mode settings, do this before install!)
cp ../example.settings.local.php ./settings.local.php
# for everyone
#!/bin/bash
# Check arguments and requirements.
if [ ${#@} -lt 1 ]; then
echo "This script expects one argument (site machine name)."
exit 1
fi
if [ -x ${HOME}/.my.cnf ]; then
echo "This script requires ${HOME}/.my.cnf."
@sqndr
sqndr / example.jquery.js
Created July 16, 2014 10:45
jQuery plugin example (js)
(function($){
$.fn.extend({
example: function(options) {
var defaults = {
color: '#000000',
}
@killua99
killua99 / changelog.sh
Created May 7, 2014 21:14
bash script to generate changelog focused for Drupal modules
#!/bin/bash
# Author: Luigi Guevara <@killua99>
#
# Use
# For a Simple Tag changelog
# ./changelog > CHANGELOG.txt
#
# For a current dev branch with the old tag log
# ./changelog 7.x-2.x > CHANGELOG.txt