Skip to content

Instantly share code, notes, and snippets.

View keopx's full-sized avatar

Ruben Egiguren keopx

View GitHub Profile
@keopx
keopx / fix-drupal-permissions.sh
Created October 16, 2017 13:31
Drupal - Bash shell script to fix Drupal permissions
#!/bin/bash
path=${1%/}
user=${2}
group="www-data"
help="nHelp: This script is used to fix permissions of a drupal installationnyou need to provide the following arguments:nt 1) Path to your drupal installationnt 2) Username of the user that you want to give files/directories ownershipnNote: "www-data" (apache default) is assumed as the group the server is belonging to, if this is different you need to modify it manually by editing this scriptnnUsage: (sudo) bash ${0##*/} drupal_path user_namen"
if [ -z "${path}" ] || [ ! -d "${path}/sites" ] || [ ! -f "${path}/modules/system/system.module" ]; then
echo "Please provide a valid drupal path"
echo -e $help
@keopx
keopx / script.pipeline
Created October 11, 2017 07:09 — forked from juampynr/script.pipeline
Jenkins job to sync Production into Develoment
String pro_domain = '2017.drupalcamp.es'
String dev_domain = 'dev.drupalcamp.es'
String drush_pro = "drush -l ${pro_domain} -r /var/www/${pro_domain}/current/web"
String drush_dev = "drush -l ${dev_domain} -r /var/www/${dev_domain}/current/web"
String files_pro = "/var/www/${pro_domain}/shared/web/sites/default/files/"
String files_dev = "/var/www/${dev_domain}/shared/web/sites/default/files/"
String rsyncOpts = '-azv --delete --exclude .php --exclude php --exclude styles'
String deploySshKeyId = 'some-key-id'
lock(resource: "dev.drupalcamp.es") {
@keopx
keopx / varnish-purge-cache.sh
Created October 3, 2017 06:33 — forked from andrezrv/varnish-purge-cache.sh
Purge all Varnish cache.
# Purge all Varnish cache
varnishadm "ban req.url ~ /"
@keopx
keopx / langoliers.rb
Created March 28, 2017 16:46 — forked from robinsloan/langoliers.rb
Tweet delete script
require "rubygems"
require "twitter"
require "json"
# things you must configure
TWITTER_USER = "your_username"
MAX_AGE_IN_DAYS = 1 # anything older than this is deleted
# get these from dev.twitter.com
CONSUMER_KEY = "your_consumer_key"
@keopx
keopx / template.tpl.php
Created November 23, 2016 09:23 — forked from gagarine/template.tpl.php
Working with drupal theme_menu_tree
<?php
/**
* Theme_menu_tree doesn't provide any context information
* THIS SUCKS
* But you can use hook_block_view_alter to change the theme wrapper
* OUF!
*/
function MYTHEME_menu_tree(&$variables) {
@keopx
keopx / resources.md
Created November 13, 2016 10:18 — forked from skwashd/resources.md
DrupalCon Dublin: Let the Machines do the Work
@keopx
keopx / README.md
Created November 13, 2016 10:17 — forked from skwashd/README.md
Drupal git pre-commit hook

This pre-commit hook is designed to be used for Drupal 7 and 8 sites.

Download the pre-commit file. Save it as .git/hook/pre-commit in your git repo. You need to ensure that the file is executable.

If you want this to be added to all new projects automatically, add it to your git init templates.

To install and PHP CodeSniffer for Drupal, please read the official documentation.

To see this working checking out this short YouTube video.

@keopx
keopx / Using_pool.txt
Last active February 9, 2016 11:13 — forked from paslandau/guzzle-append-requests-on-the-fly-generator-vs-retry.php
Example of appending requests on the fly using an ArrayIterator as generator and comparing that approach to $event->retry() and $client->send()
http://stackoverflow.com/questions/28105093/incrementally-add-requests-to-a-guzzle-5-0-pool-rolling-requests
https://github.com/guzzle/guzzle/issues/946
http://docs.guzzlephp.org/en/latest/quickstart.html#concurrent-requests
@keopx
keopx / phpstormdebug.sh
Created November 4, 2015 08:07
PHPSTORM debug
#!/bin/sh
export XDEBUG_CONFIG="idekey=PHPSTORM"
php bin/phpspec run
@keopx
keopx / template-choser.md
Created October 26, 2015 19:45 — forked from mortendk/template-choser.md
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.