Skip to content

Instantly share code, notes, and snippets.

var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var sourcemaps = require('gulp-sourcemaps');
var livereload = require('gulp-livereload');
gulp.task('sass', function () {
gulp.src('scss/styles.scss')
.pipe(sourcemaps.init())
.pipe(sass())
var less = require('gulp-less');
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var ftp = require( 'vinyl-ftp' );
var gutil = require( 'gulp-util' );
gulp.task('less', function () {
var conn = ftp.create( {
host: '*****.ru',
user: '*****',
FROM php:7-fpm
ENV COMPOSER_VERSION 1.2.0
# Recreate user with correct params
RUN deluser www-data && \
groupadd -g 82 -r www-data && \
useradd -u 82 -r -s /bin/bash -g www-data www-data && \
sed -i '/^www-data/s/!/*/' /etc/shadow
@alexd73
alexd73 / clone_node
Last active September 23, 2017 15:46
drupal 8: Node and fields manipulation
// clone node programmatically
$node = \Drupal\node\Entity\Node::load($nid);
if ($node) {
$cloned_node = $node->createDuplicate();
$cloned_node->save();
}
// Static Image on front page
$form['royal_spa_hotel_settings']['pages_settings']['static_image'] = [
'#type' => 'managed_file',
'#title' => t('Static image on front page'),
'#upload_validators' => [
'file_validate_extensions' => ['gif png jpg jpeg'],
'file_validate_size' => [25600000],
],
'#theme' => 'image_widget',
'#preview_image_style' => 'medium',
<?php
/**
* Убирает из массива элемент по его значению
* @param $arr
* @param $value
*/
function unset_by_value(&$arr, $value){
if (($key = array_search($value, $arr)) !== false) {
unset($arr[$key]);
}
@alexd73
alexd73 / keybindings.json
Last active November 8, 2018 14:13
Настройки vscode
[
{
"key": "shift+numpad2",
"command": "cursorDownSelect",
"when": "textInputFocus"
},
{
"key": "shift+numpad1",
"command": "cursorEndSelect",
"when": "textInputFocus"
@alexd73
alexd73 / drone.service
Last active February 8, 2019 12:33
create service with docker-compose in ubuntu
# /etc/systemd/system/drone.service
[Unit]
Description=Drone server
After=docker.service nginx.service
[Service]
Restart=always
ExecStart=/usr/local/bin/docker-compose -f /etc/drone/docker-compose.yml up
ExecStop=/usr/local/bin/docker-compose -f /etc/drone/docker-compose.yml stop
@alexd73
alexd73 / extra patches
Last active February 8, 2019 12:56
composer.jsom
"drupal/block_styles": {
"Notice: Undefined index after placing block": "https://www.drupal.org/files/issues/2642010-7-fix-block-notice.patch",
"Notice: Undefined index: #id in block_styles_theme_suggestions_block_alter() ": "https://www.drupal.org/files/issues/notice_undefined-2725167-3.patch",
"array flip issue": "https://www.drupal.org/files/issues/2018-06-23/2890458_fix_array_flip.patch"
},
"drupal/ds": {
"Warning: Invalid argument supplied for foreach() in /ds/ds.module on line 504": "https://www.drupal.org/files/issues/2018-04-21/invalid_argument_in_ds_module-2904575-7.patch"
},
"drupal/owlcarousel": {
"Theme hook owl not found (solved)": "https://www.drupal.org/files/issues/drupal-8_owlcarousel_theme_hook_owl_not_found_2917939-2.patch"
export CUSTOM_BARRIO=$1 # change this to your custom theme_name
cp -r ../contrib/bootstrap_sass $CUSTOM_BARRIO
cd $CUSTOM_BARRIO
for file in *bootstrap_sass.*; do mv $file ${file//bootstrap_sass/$CUSTOM_BARRIO}; done
for file in config/*/*bootstrap_sass.*; do mv $file ${file//bootstrap_sass/$CUSTOM_BARRIO}; done
grep -Rl bootstrap_sass .|xargs sed -i'' -e "s/bootstrap_sass/$CUSTOM_BARRIO/"
grep -Rl bootstrap_barrio .|xargs sed -i'' -e "s/bootstrap_barrio/$CUSTOM_BARRIO/"