Skip to content

Instantly share code, notes, and snippets.

@szeidler
szeidler / gist:afb11c7033ee758919d9
Created September 14, 2014 14:53
This function name has a typo which makes me laugh
<?php
/**
* Determine whether a given bootstrap phase has been completed
*
* This function name has a typo which makes me laugh so we choose not to
* fix it. Take a deep breath, and smile. See
* http://en.wikipedia.org/wiki/HTTP_referer
*
*
* @param phase
@szeidler
szeidler / trigger-aegir-hosting.sh
Created November 5, 2014 11:33
Trigger aegir hosting
sudo /etc/init.d/hosting-queued start
@szeidler
szeidler / drush-up-security-only.sh
Last active August 29, 2015 14:10
Updates all drush core and contrib modules with security issues
drush up --security-only
@szeidler
szeidler / drush-make-keep-working-git.sh
Last active August 29, 2015 14:10
Drush make with keeping the working git directory and concurrency option
drush make --working-copy --concurrency=10 http://makefile.com/makefile.make platform
@szeidler
szeidler / check-if-cli.php
Created January 27, 2015 16:21
Check if the actual request is coming from PHP CLI
<?php
$sapi = php_sapi_name();
if ($sapi === 'cli') {
print 'This is a cli request';
}
@szeidler
szeidler / gist:206b715deff23301d26d
Created October 23, 2014 12:53
Create zen subtheme with drush
drush zen --name="$Themename" --machine-name="$theme_machine_name" --path="sites/$site/themes/" --without-rtl
@szeidler
szeidler / drushrc.php
Last active January 8, 2016 09:56
drushrc.php
<?php
// Define module download destination.
$site_path = drush_site_path();
$site_path_parts = explode('/', $site_path);
$clean_site_path_parts = array_slice($site_path_parts, -2, 2);
$clean_site_path = implode('/', $clean_site_path_parts);
if (!empty($clean_site_path)) {
$command_specific['dl']['destination'] = $clean_site_path . '/modules/contrib';
}
@szeidler
szeidler / responsive_video_embed_field.css
Created January 19, 2016 12:59
Responsive video_embed_field – Simple markup as an alternative for https://www.drupal.org/project/fitvids
.embedded-video .player {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
max-width: 100%;
}
.embedded-video .player iframe,
.embedded-video .player object,
@szeidler
szeidler / workaround_missing_vendor_libraries_d8_aegir_migration.sh
Last active April 21, 2016 10:45
Workaround for missing vendor libraries, when migrating D8 sites with aegir
#!/bin/bash
## Aegir has major problems while migrating sites, when the new platform doesn't have the vendor libraries available.
## Here is a workaround for solving that problem.
## Copy the working site into the new platform.
## That needs to be done, to let composer_manager know about all the site package requirements
cp -r /var/aegir/platforms/old_platform/sites/site.name.org /var/aegir/platforms/new_platform/sites/site.name.org.migration
cd /var/aegir/platforms/new_platform
## Initialize composer_manager if not already done
@szeidler
szeidler / template.php
Last active June 20, 2016 21:19
Hide Facet API counter
<?php
function theme_facetapi_tabs_inactive($variables) {
unset($variables['count']);
return theme_link($variables);
}
function theme_preprocess_facetapi_link_inactive(&$variables) {
// hide facet count
unset($variables['count']);