Skip to content

Instantly share code, notes, and snippets.

@pcambra
pcambra / wildcard.conf
Last active Nov 18, 2016
Generate self signed cert
View wildcard.conf
# —------------ BEGIN custom wildcard.conf —---
oid_section = new_oids
[ new_oids ]
[ req ]
default_days = 3650 # how long to certify for
distinguished_name = req_distinguished_name
encrypt_key = no
string_mask = nombstr
req_extensions = v3_req # Extensions to add to certificate request, needed for multiname
[ req_distinguished_name ]
View ember-leaflet.js
// application.hbs
<div class="container">
{{partial 'navbar'}}
{{leaflet-map}}
{{outlet}}
</div>
// leaflet-map.hbs
View gist:2ce7914e8e7099ee4c30b681753fe8b4
# While the issues with php7-memcached are solved...
RUN echo "http://dl-4.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
echo "http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
apk update && \
apk --update add libmemcached-dev \
autoconf \
build-base \
libtool \
php7-pear \
php7-dev \
View gist:2f459665301e2ffe508b59b3bf8e3315
alias gimmepass="openssl rand -base64 12 |md5 |head -c12;echo"
@pcambra
pcambra / Drupal8UITestsPermissionError.md
Created Aug 29, 2016
Drupal 8: Workaround for permission errors when running tests from the UI
View Drupal8UITestsPermissionError.md
View gist:f39c61210b62a39677f7c03f507b1a58
function my_module_entity_view(&$build, EntityInterface $entity, EntityViewDisplayInterface $display) {
if ($entity instanceof FieldableEntityInterface && $entity->hasField('field_name')) {
foreach (Element::children($build['field_name']) as $item) {
$build['field_name'][$item]['#attributes'] = ['class' => 'my-class'];
}
}
}
View unfollows.sh
#!/bin/sh
NOW=$(date +"%F")
LOGFILE="followers-$NOW.log"
t followers -s > /tmp/unfollows.log
cat /tmp/unfollows.log | wc -l > $LOGFILE
cat /tmp/unfollows.log >> $LOGFILE
# Print results for the last update.
echo "Diff since last time";
View hr_decommissioner_list_usage_panels
function hr_decommissioner_drush_command() {
$items['hr-decommissioner-list-hr-contacts-panes'] = array(
'description' => "List the contact panes from all spaces",
'drupal dependencies' => array(),
'aliases' => array(),
);
return $items;
}
@pcambra
pcambra / hr_contacts.drush.inc
Created Dec 28, 2015
Get contacts present on Hrinfo but not on HID export files
View hr_contacts.drush.inc
<?php
/**
* @file
* hr_contacts module drush integration.
*/
/**
* Implements hook_drush_command().
*
View feeds_file_field_collection.php
/**
* Implements hook_feeds_processor_targets_alter().
*
* Overrides the file.inc mapping to correctly set the allowed extensions for
* files inside field collections.
*/
function {my_module}_feeds_processor_targets_alter(array &$targets, $entity_type, $bundle) {
if ($bundle == 'field_files_collection') {
foreach ($targets as $target_id => &$target) {