Skip to content

Instantly share code, notes, and snippets.

View andriyun's full-sized avatar
💭
drupaling

Andriyun andriyun

💭
drupaling
View GitHub Profile
@andriyun
andriyun / template.php
Last active August 29, 2015 14:06 — forked from mrcgrtz/template.php
<?php
/**
* Override or insert variables into the HTML head.
*
* @param $head_elements
* An array of variables to pass to the HTML head.
*/
function MYTHEME_html_head_alter(&$head_elements) {
// remove unneeded metatags
$remove = array(
@andriyun
andriyun / vdd_reinstall.yml
Created March 3, 2015 17:49
VDD Reinstall playbook
---
- hosts: drupal_dev
vars:
document_root: d7
admin_user: root
admin_pass: root
db_name: d7
db_user: root
db_pass: root
disable_modules: overlay toolbar
@andriyun
andriyun / backup-drupal-project.yml
Last active January 7, 2021 03:06
ansible backup playbook
---
- hosts: [hostgroup]
# hostgroup name to aplly playbook from ~/.ansible/hosts
vars:
project_name: [project_name]
# project name for backup files
document_root_location: [document_root_location]
# document root location path without trailing slash
# Example: /home/dtest01
document_root_folder: [document_root_folder]
#!/bin/sh
# PHP CodeSniffer pre-commit hook for git
# We should place it to server scripts directory to subfolder drupal-git-hooks and add hook symlink from
# repository .git directory to path/to/drupal-git-hooks
# ln -s -f /path/to/drupal-git-hooks .git/hooks
PHPCS_BIN=/usr/bin/phpcs
PHPCS_CODING_STANDARD=Drupal
PHPCS_IGNORE=
@andriyun
andriyun / gist:357fd3fcda55609079a2
Created December 1, 2015 18:30
Delete all table without droping database in postgres
drop schema public cascade;
create schema public;
@andriyun
andriyun / gist:8bdffb9d2cdb04807433
Last active January 14, 2016 10:44
Docker drupal
sudo docker run -p 8000:80 -p 2200:22 -v $(pwd):/var/www/html:rw dockie/drupal-site-install
sudo docker ps
sudo docker exec -it [containerhash] bash
@mixin resize-sprite($map, $sprite, $percent) {
$spritePath: 'generated/' + sprite-path($map);
$spriteWidth: image-width($spritePath);
$spriteHeight: image-height($spritePath);
$width: image-width(sprite-file($map, $sprite));
$height: image-height(sprite-file($map, $sprite));
@include background-size(ceil($spriteWidth * ($percent/100)) ceil($spriteHeight * ($percent/100)));
background-image: image_url($spritePath);
width: ceil($width*($percent/100));
current_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/*\(.*\)/\1/'
}
mrgto(){
branch="$(current_git_branch)"
git checkout $1
git fetch origin $1
git merge origin/$1
git merge $branch
# MemCache
$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
$conf['page_cache_invoke_hooks'] = FALSE;
$conf['memcache_servers'] = array(
'127.0.0.1:11228' => 'default',
'127.0.0.1:11229' => 'cluster1',
'127.0.0.1:11230' => 'cluster2',
@andriyun
andriyun / drupal7 batch example
Created September 29, 2017 18:22
Example of batch function to delete nodes
/**
* Callback function for delete all nodes.
*
* @param array $types_of_content
* Array of machine node type names to delete.
*
* @param array $except_uids
* Array with uids of ingnore users who created nodes.
*/
function _delete_all_nodes($types_of_content, $except_uids = array()) {