Skip to content

Instantly share code, notes, and snippets.

@akovalyov
akovalyov / NativeProtocolExporter.php
Last active October 9, 2017 21:11
PHP Exporter to native Redis protocol.
<?php
namespace App\Infra\Redis;
use Webmozart\Assert\Assert;
class NativeProtocolExporter
{
const NEWLINE = "\r\n";
#!/usr/bin/env php
<?php
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
//umask(0000);
<?php
$finder = PhpCsFixer\Finder::create()
->in([__DIR__.'/src', __DIR__.'/tests']);
return PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
'binary_operator_spaces' => ['align_double_arrow' => true, 'align_equals' => true],
'no_multiline_whitespace_before_semicolons' => true,
@akovalyov
akovalyov / yq
Created December 20, 2016 23:07
Yaml for bash, php impl
# usage: cat app/config/parameters.yml | bin/yq '[parameters][database_host]'
#!/usr/bin/env php
<?php
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\Yaml\Yaml;
$loader = require __DIR__ . '/../app/autoload.php';
[2016-11-27 16:32:27] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\DriverException: "An exception occurred while executing 'INSERT INTO `wallabag_entry` (uuid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public, user_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [null, "How to encrypt your entire life in less than an hour", "https:\/\/medium.freecodecamp.com\/tor-signal-and-beyond-a-law-abiding-citizens-guide-to-privacy-1a593f2104c3?gi=45f85b8c3f2", 0, 0, "<blockquote name=\"604b\" id=\"604b\" class=\"graf graf--pullquote graf--startsWithDoubleQuote graf-after--figure\">\u201cOnly the paranoid survive.\u201d\u200a\u2014\u200aAndy\u00a0Grove<\/blockquote><p name=\"e1f9\" id=\"e1f9\" class=\"graf graf--p graf-after--pullquote\">Andy Grove was a Hungarian refugee who escaped communism, studied engineering, and ultimately led the personal computer revolution as the CEO of Intel.
<?php
namespace AppBundle\Security\Authentication;
use AGILEmentBundle\Entity\User;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
class AutoLogin
{
andrew:/tmp$ composer require knplabs/knp-paginator-bundle --profile
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
[63.8MB/10.30s] Using version ^2.5 for knplabs/knp-paginator-bundle
[64.0MB/10.30s] ./composer.json has been created
[65.1MB/10.46s] Loading composer repositories with package information
[65.3MB/10.80s] Updating dependencies (including require-dev)
[286.5MB/72.84s] - Installing twig/twig (v1.24.0)
[286.6MB/72.88s] Loading from cache
[286.8MB/72.99s]
[286.7MB/73.00s] - Installing knplabs/knp-components (1.3.2)
/*
html2canvas 0.5.0-beta2 <http://html2canvas.hertzen.com>
Copyright (c) 2015 Niklas von Hertzen
Released under MIT License
*/
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({},{},[]);
/*
html2canvas 0.5.0-beta2 <http://html2canvas.hertzen.com>
Copyright (c) 2015 Niklas von Hertzen
Released under MIT License
*/
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.html2canvas=a()}}(function(){var a;return function b(a,c,d){function e(g,h){if(!c[g]){if(!a[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};a[g][0].call(k.exports,function(b){var c=a[g][1][b];return e(c?c:b)},k,k.exports,b,a,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(b,c,d){(function(b){!function(e){function f(a){throw RangeError(I[a])}function g(a,b){for(var c=a.length,d=[];c--;)d[c]=b(a[c]);retu
/*
html2canvas 0.5.0-beta2 <http://html2canvas.hertzen.com>
Copyright (c) 2015 Niklas von Hertzen
Released under MIT License
*/
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({},{},[])