Skip to content

Instantly share code, notes, and snippets.

Avatar

keopx keopx

View GitHub Profile
@juampynr
juampynr / README.md
Created May 31, 2016
Run Drupal 8 web tests without installing Drupal
View README.md
  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 Aug 6, 2019
Sample Guzzle 6 request to Drupal 8 using OAuth 1
View README.md

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.
View phpstormdebug.sh
#!/bin/sh
export XDEBUG_CONFIG="idekey=PHPSTORM"
php bin/phpspec run
View phpstormdebug.sh
#!/bin/sh
export XDEBUG_CONFIG="idekey=PHPSTORM"
php bin/phpspec run
View DrupalConsole-Drupal8.md

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 Apr 29, 2016
Drupal8 concept for selecting templates form the ui
View template-choser.md

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 May 22, 2021
Drupal 8 - Examples
View __INDEX.txt
# 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 Apr 25, 2017
Drupal 8 reinstall site script
View drupal8_reinstall.sh
#!/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
View drupal-install.sh
#!/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 Jul 16, 2014
jQuery plugin example (js)
View example.jquery.js
(function($){
$.fn.extend({
example: function(options) {
var defaults = {
color: '#000000',
}