Skip to content

Instantly share code, notes, and snippets.

<?php
function THEME_html_head_alter(&$head_elements) {
$head_elements['system_meta_generator']['#attributes']['content'] = "Drupal 8 (http://drupal.org)";
}
<?php
/**
* Implements hook_entity_info_alter().
*/
function MYMODULE_entity_info_alter(&$entity_info) {
$entity_info['node']['view modes']['another_teaser'] = array(
'label' => t('Another teaser'),
'custom settings' => TRUE,
);
@opi
opi / ynh_nginx_ssl.md
Last active August 29, 2015 14:01
Experimental Nginx config that will give you an A+ grade on ssllabs.com.

# Yunohost Nginx fine tuning

Experimental Nginx config that will give you an A+ grade on ssllabs.com.

Most of this config could be merged into yunohost default, except the dhparam.pem file creation, because it takes too much time.

Generate dh2048.pem

openssl dhparam -out /etc/ssl/private/dh2048.pem -outform PEM -2 2048
@opi
opi / gist:9408c9f03b1400f8c4df
Created August 14, 2014 19:29
I call it art
// Generate a random DOM.
// http://twitter.com/cowboy/status/65845594400362496
(function(s,n){while(n--){s.push($('<div/>').appendTo(s[~~(Math.random()*(s.length-1))]))}})(['body'],10000);
// Cycle bg, starting at a random color.
(function(time){
var start = Math.floor(Math.random() * time);
var dec = "animation: bgcolors -" + start + "s " + time + "s linear infinite;";
var html = "<style>html{-webkit-" + dec + dec + "}</style>";
$("head").append(html);
#!/bin/bash
# Download drush if needed
if [ ! -d drush ]
then
# Download
wget https://github.com/drush-ops/drush/archive/6.4.0.tar.gz
# Unpack
tar xvzf 6.4.0.tar.gz
# Rename
@opi
opi / gist:cceecf9602013e3f4135
Last active August 29, 2015 14:07
YNH Poodle

YunoHost Poodle battle plan

## Dovecot

File : /etc/dovecot/dovecot.conf
Add :

ssl_protocols = !SSLv2 !SSLv3

and service dovecot restart

-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.11 (GNU/Linux)
owFtkntQVFUcx3cXeYXITjIS1RKtOAyy7Jxz35dJUQJshMI/KENG1nPvPXe5PHbX
fQWDmNiDoZympmAtQs0clCGYcCSKVwmFSAl/6EQqZNSMSuIENGBGZPcy9HCmc/45
5/w+53t+39/vvBkZpAvTJzif1X+BPjbpv54SdHnZfrbSLDilCnNqpVksVbDDq60c
qAybU80luEJAHmxVnPEOp4StxZ74FcZi9mO3R3E6VApYWSthrrJouHZZVhx27Ha5
FU3LjHiWFimBRYCANEURQCIZgHmCoBiZpgEUAQMFACVVssjp8d73qnlZ06ZI6qnK
Z2n8kyqfDmCGGvMtBzCLOZICPOAEhmQICEVEQIkggURzJAGABnqwe8WS06VoqZZh
d0kptrmdzmW/olfRopCCFEFCmmfVZJCnSOVpHgIOA4x4JDCswEKelCiJI0VRYDCQ
@opi
opi / gist:5200c4ff5c298ad3103e
Created January 15, 2015 10:29
Drupal list all public views urls (page & feed)
<?php
// Views page and feeds list
$views = array();
foreach (views_get_enabled_views() as $view_name => $view) {
// Filter views having no display
if (count($view->display) > 1 && (strpos($view_name, 'admin') === FALSE)) {
$views[$view_name] = array(
'#theme' => 'item_list',
'#title' => $view->human_name,
@opi
opi / gist:c0cb89a3b7c934c5fe7a
Created February 6, 2015 14:26
Drupal paragraphs summary
<?php
/**
* @file
* Holds relevant functions for paragraph field formatters.
*/
/**
* Implements hook_field_formatter_info().
*/
@opi
opi / gist:45de0e8258b82d298dc5
Created February 26, 2015 11:18
Drupal Fix seven CSS for wysiwyg textfields
/* Fix seven CSS stupidity */
.wysiwyg-toggle-wrapper {
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
padding: 0 8px;
}
.filter-wrapper,
.wysiwyg-toggle-wrapper {
margin-right: 1px;