Skip to content

Instantly share code, notes, and snippets.

Avatar

keopx keopx

View GitHub Profile
View varnish-purge-cache.sh
# Purge all Varnish cache
varnishadm "ban req.url ~ /"
@keopx
keopx / langoliers.rb
Created Mar 28, 2017 — forked from robinsloan/langoliers.rb
Tweet delete script
View langoliers.rb
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 Nov 23, 2016 — forked from gagarine/template.tpl.php
Working with drupal theme_menu_tree
View template.tpl.php
<?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 Nov 13, 2016 — forked from skwashd/resources.md
DrupalCon Dublin: Let the Machines do the Work
View resources.md
@keopx
keopx / README.md
Created Nov 13, 2016 — forked from skwashd/README.md
Drupal git pre-commit hook
View README.md

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 Example of appending requests on the fly using an ArrayIterator as generator and comparing that approach to $event->retry() and $client->send()
View Using_pool.txt
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
View phpstormdebug.sh
#!/bin/sh
export XDEBUG_CONFIG="idekey=PHPSTORM"
php bin/phpspec run
@keopx
keopx / template-choser.md
Created Oct 26, 2015 — forked from mortendk/template-choser.md
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.

@keopx
keopx / phpunit_wrap.php
Last active Oct 26, 2015 — forked from dawehner/gist:1fc1683b1212cae1ee66
wrap phpunit with the needed env vars
View phpunit_wrap.php
<?php
function phpunit --description "wrap phpunit with the needed env vars"
set -g -x SIMPLETEST_DB 'mysql://root@localhost/dev_d8'
set -g -x SIMPLETEST_BASE_URL 'http://d8.dev'
command phpunit $argv
end
View DrupalConsole-Drupal8.md

Download DrupalConsole

curl -LSs http://drupalconsole.com/installer | php

Make DrupalConsole globaly accesible

mv console.phar /usr/local/bin/drupal