Skip to content

Instantly share code, notes, and snippets.

View thelebster's full-sized avatar
:octocat:
Do nothing, it is ok.

Anton Lebedev thelebster

:octocat:
Do nothing, it is ok.
View GitHub Profile
#!/bin/bash
drush sql-dump --gzip --result-file=backup-xxxx.sql.gz --structure-tables-list=cache,cache_*,cache_filter,cache_form,cache_menu,cache_page,history,sessions,watchdog
@thelebster
thelebster / local.settings.php
Created October 22, 2016 05:36 — forked from szeidler/local.settings.php
Make drupal purge varnish cache after node changes
<?php
// Varnish
$conf['cache_backends'][] = 'sites/all/modules/contrib/varnish/varnish.cache.inc';
$conf['cache_class_cache_page'] = 'VarnishCache';
// Drupal 7 does not cache pages when we invoke hooks during bootstrap. This needs
// to be disabled.
$conf['page_cache_invoke_hooks'] = FALSE;
$conf['reverse_proxy'] = TRUE;
<?php
/**
* @file
* Default simple view template to display a list of rows.
*
* @ingroup views_templates
*/
?>
<?php if (!empty($title)): ?>
@thelebster
thelebster / HotelMigration.inc
Created October 22, 2016 05:37 — forked from szeidler/HotelMigration.inc
Drupal Migration example class of geofield fields.
<?php
class HotelMigration extends Migration {
public function __construct(array $arguments) {
parent::__construct($arguments);
$this->description = t('Import of hotels');
$columns = array(
0 => array('StreetId', 'StreetId'),
@thelebster
thelebster / unlock-fields.php
Created October 22, 2016 05:43 — forked from szeidler/unlock-fields.php
Unlock drupal fields. For example with devels PHP block
<?php
$field_name = 'field_name';
$field = field_read_field($field_name);
$field['locked'] = 0; // 0: unlock; 1: lock.
field_update_field($field);
@thelebster
thelebster / crossbrowser-transparency.scss
Created October 22, 2016 05:44 — forked from szeidler/crossbrowser-transparency.scss
Add's crossbrowser alpha-transparency background-color ability
// Usage: @include transparent(#000, 0.6);
@mixin transparent($color, $alpha) {
$rgba: rgba($color, $alpha);
$ie-hex-str: ie-hex-str($rgba);
background-color: transparent;
background-color: $rgba;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#{$ie-hex-str}, endColorstr=#{$ie-hex-str});
zoom: 1;
}
@thelebster
thelebster / html5-image-with-caption-author.html
Created October 22, 2016 05:44 — forked from szeidler/html5-image-with-caption-author.html
Clean HTML5 image with caption and author
<figure class="image-captioned">
<img alt="Alternative text" src="http://master.media.ramsalt.dev/sites/master.media.ramsalt.com/files/img_7298.jpg" />
<figcaption>
<span class="image-captioned-text">This is the image caption</span>
<span class="image-captioned-byline">Matts Photoman</span>
</figcaption>
</figure>
@thelebster
thelebster / loop-fontfiles.scss
Created October 22, 2016 05:44 — forked from szeidler/loop-fontfiles.scss
Generate @font-face for a whole font familiy in several file formats.
/*
* See: http://www.oliverdavies.co.uk/blog/include-css-fonts-using-sass-each-loop
* Usage: font-family: "FuturaBook";
*/
@each $family in FuturaBook, FuturaBold, FuturaBoldItalic, FuturaItalic {
@font-face {
font-family: #{$family};
src: url('../fonts/#{$family}/#{$family}.eot');
src: url('../fonts/#{$family}/#{$family}.eot?#iefix') format('embedded-opentype'),
url('../fonts/#{$family}/#{$family}.woff') format('woff'),
@thelebster
thelebster / drupal-ajax-accordion.js
Created October 22, 2016 05:45 — forked from szeidler/drupal-ajax-accordion.js
Use custom jQuery toggle functionality in Drupal 7 to prevent multiple triggered elements, because of updated DOM
(function ($) {
Drupal.behaviors.accordion = {
attach: function (context, settings) {
$('.accordion h3.title').once('accordion', function () {
$('.accordion h3.title').toggle(function () {
// Actions here
}, function () {
// Actions here
});
});
@thelebster
thelebster / drush-site-install
Created October 22, 2016 05:45 — forked from szeidler/drush-site-install
Drush site install command
drush site-install standard --db-url='mysql://[db_user]:[db_pass]@localhost/[db_name]' --site-name=Example --sites-subdir=example.com --account-name=admin --account-pass=password --account-mail=mail@example.com