Skip to content

Instantly share code, notes, and snippets.

View Berdir's full-sized avatar

Sascha Grossenbacher Berdir

View GitHub Profile
@webchick
webchick / gist:5663b5289d8c6c4c0445
Last active November 16, 2015 23:16
contrib_tracker issues by count
SELECT n.nid, n.title, flag.count AS cnt
FROM node n
INNER JOIN flag_counts flag ON flag.entity_id = n.nid
INNER JOIN field_data_field_project project on project.entity_id = n.nid
WHERE flag.fid = 4 /* project_issue_follow */
AND project.field_project_target_id = 2573607 /* contrib_tracker */
GROUP BY n.nid
ORDER BY cnt DESC
LIMIT 100;
{
"minimum-stability": "dev",
"require": {
"composer/installers": "dev-drupal-core",
"drupal/drupal-core": "8.0.*",
"drupal/devel": "dev-8.x-1.x",
"drupal/config_devel": "dev-8.x-1.x"
},
"require-dev": {
"drupal/devel": "dev-8.x-1.x",
@star-szr
star-szr / services.yml
Last active August 29, 2015 13:59
Disable cache_render or other cache bins in Drupal 8
services:
cache.backend.memory:
class: Drupal\Core\Cache\MemoryBackendFactory
@sun
sun / config-dev.patch
Last active August 29, 2015 13:59
D8 config in files for development
diff --git a/sites/default/settings.php b/sites/default/settings.php
index b2ce930..9d0514e 100644
--- a/sites/default/settings.php
+++ b/sites/default/settings.php
@@ -611,7 +611,8 @@
* The 'bootstrap_config_storage' setting needs to be a callable that returns
* core.services.yml.
*/
- # $settings['bootstrap_config_storage'] = array('Drupal\Core\Config\BootstrapConfigStorageFactory', 'getFileStorage');
+$settings['bootstrap_config_storage'] = 'Drupal\Core\Config\BootstrapConfigStorageFactory::getFileStorage';
@skwashd
skwashd / pre-commit
Last active January 4, 2016 04:59
Git pre-commit hook for checking files with coder-review and php lint. This prevents developers committing broken PHP or code that doesn't comply with the Drupal coding standards.Add this file to .git/hooks/pre-commit in the root of your doc repo and make it executable (chmod +x .git/hooks/pre-commit).You must have the coder module in ~/.drush/T…
#!/bin/bash
#
# Git pre-commit hook for Drupal projects.
# Created by Dave Hall - http://davehall.com.au
# Distributed under the terms of the WTFPL - http://www.wtfpl.net/
#
set -e
@sun
sun / reinstall.php
Last active December 31, 2015 06:39
D8 reinstall.php
<?php
/**
* This gist is no longer maintained - it is a proper repo now:
*
* @see https://github.com/sun/drupal-reinstall
*/
# ██╗ ██╗██████╗ ██████╗ ███╗ ██╗ ██████╗
@feeela
feeela / function.wrap-scripts-and-styles-into-cdata.php
Last active August 21, 2018 15:28
Add CDATA to script- and style-tags via regex using PHPs output buffering
<?php
/* do this if MIME type is 'application/xhtml+xml' */
ob_start(function ($buffer) {
$replacer = array(
'/(<script[^<>]*>)([^<>]+)(<\/script>)/' => '$1<![CDATA[ $2 ]]>$3',
'/(<style[^<>]*>)([^<>]+)(<\/style>)/' => '$1<![CDATA[ $2 ]]>$3',
/* more replaces may follow, like:
* replace ampersand-characters, which are not part of an entity or within a CDATA-block
<?php
require './core/vendor/autoload.php';
use Symfony\Component\Yaml\Parser;
function quantile($values, $p) {
sort($values);
$H = (count($values) - 1) * $p + 1;
$h = floor($H);
$v = $values[$h - 1];