Skip to content

Instantly share code, notes, and snippets.

@Punk-UnDeaD
Punk-UnDeaD / 1.php
Created April 6, 2021 17:28
include
<?php $i=1;
@Punk-UnDeaD
Punk-UnDeaD / bench.md
Last active March 7, 2021 14:22
Сравнительная таблица замеров производительности RoadRunner и nginx+php-fpm

Окружение - Убунту, докер, PHP8, firefox.

Данные - отчёт из вкладки Network. OpCache+Preload включен, jit не используется.

Фреймворк - Symfony 5.3

Простой контроллер с рендером твига.

RoadRunner nginx+php-fpm
<?php
declare(strict_types=1);
namespace App\Container;
#[\Attribute(\Attribute::TARGET_PROPERTY)]
class AutoInject
{
sudo socat tcp-listen:8000,reuseaddr,fork tcp:localhost:80
'use strict';
const gulp = require("gulp");
const sass = require('gulp-sass');
// const autoprefixer = require('autoprefixer');
const sourcemaps = require('gulp-sourcemaps');
const livereload = require('gulp-livereload');
const export_sass = require('node-sass-export');
const sassGlob = require('gulp-sass-glob');
const postcss = require('gulp-postcss');
@Punk-UnDeaD
Punk-UnDeaD / youtube-api.js
Last active December 9, 2019 15:20
youtube api
window.Drupal = window.Drupal || {};
((document) => {
let tag = document.querySelector('script[src*="youtube.com/iframe_api"]');
const html = document.querySelector('html');
let timer;
let YT = null;
Drupal.YT = function (callback) {
if (YT) {
callback(YT);
((document, window) => {
window.App = window.App || {};
let tag = null;
let YT = null;
const html = document.querySelector('html');
App.YT = function (callback) {
if (!tag) {
tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
document.querySelector('head').append(tag);
@Punk-UnDeaD
Punk-UnDeaD / .bashrc
Created August 21, 2019 14:31
docker-compose alias
alias drush="docker-compose exec php vendor/bin/drush"
alias drupal="docker-compose exec php vendor/bin/drupal"
alias composer="docker-compose exec php composer"
class BindedTemplate extends HTMLTemplateElement {
processTokens() {
return this._tokens.map((token) => {
token = token.substr(2, token.length - 3);
let not = token[0] === '!';
let notnot = not && token[1] === '!';
if (not) {
token = token.substr(not + notnot);
}
let value = token.split('.').reduce((value, subtoken) => {
drush ev "return ['namespaces' => array_map(function (\$s) {return ['namespace' => \$s,'path' => Drupal::service('twig.loader.filesystem')->getPaths(\$s)[0]];}, Drupal::service('twig.loader.filesystem')->getNamespaces())]" --format=json > web/ide-twig.json