Skip to content

Instantly share code, notes, and snippets.

@plfort
plfort / switchBranch.sh
Created January 18, 2024 08:21
Symfony/Doctrine - Switch git branch while taking account of Doctrine migrations
#!/bin/bash
set -eu
export XDEBUG_MODE=off
NEW_BRANCH=$1
CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`
MIGRATIONS_DIR=migrations
MIGRATIONS_NAMESPACE=DoctrineMigrations\
echo "Switching to $1"
@plfort
plfort / devicename_nvme.sh
Last active March 24, 2021 10:00
Ansible role - Format and mount EBS NVME device for Ubuntu
#!/bin/bash
set -o errexit
set -o nounset
#https://github.com/oogali/ebs-automatic-nvme-mapping
for dev in /dev/nvme[0-9]*n1; do
devicename=$(nvme id-ctrl --output binary -v $dev |cut -c3073-3104 |tr -d '[:space:]')
if [ "$devicename" = "$1" ]; then
echo $dev
fi
@plfort
plfort / mjpeg.js
Created October 28, 2018 20:39 — forked from codebrainz/license.txt
MJPEG Player in JavaScript
// namespace MJPEG { ...
var MJPEG = (function(module) {
"use strict";
// class Stream { ...
module.Stream = function(args) {
var self = this;
var autoStart = args.autoStart || false;
self.url = args.url;
@plfort
plfort / webpack.config.js
Created January 5, 2018 08:22
Symfony Encore trick for completion in PHPStorm (Can't analyse webpack.config.js)
...
let config = Encore.getWebpackConfig();
if(!Encore.isProduction()) {
fs.writeFile("fakewebpack.config.js", "module.exports = "+JSON.stringify(config), function(err) {
if(err) {
return console.log(err);
}
console.log("fakewebpack.config.js written");
});
}
<?php
namespace XXX\Bundle\CoreBundle\Services\Grid;
use APY\DataGridBundle\Grid\Source\Entity;
use APY\DataGridBundle\Grid\Column\Column;
use APY\DataGridBundle\Grid\Rows;
use APY\DataGridBundle\Grid\Row;
use Doctrine\ORM\NoResultException;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\HttpKernel\Kernel;