Skip to content

Instantly share code, notes, and snippets.

View mysiar's full-sized avatar
🌐
Working remotely

Piotr Synowiec mysiar

🌐
Working remotely
View GitHub Profile
@mysiar
mysiar / diffArrayCollection.php
Last active April 1, 2018 18:44
Comparing two ArrayCollections
<?php
/**
* Diff of two Object Collections
*
* @param Collection $collection1
* @param Collection $collection2
* @param string[] $fieldsToOmit - fields to omit from comparison
* @return Collection|ArrayCollection
*/
@mysiar
mysiar / InstallPostman.sh
Created April 28, 2018 10:43
Install Postman
sudo rm -rf /opt/Postman
wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
sudo tar -xzf postman.tar.gz -C /opt
rm postman.tar.gz
sudo ln -s /opt/Postman/Postman /usr/bin/postman
cat > ~/.local/share/applications/postman.desktop <<EOL
[Desktop Entry]
Encoding=UTF-8
Name=Postman
@mysiar
mysiar / refind_linux_windows.bat
Last active May 4, 2018 17:35
rEFInd linux windows
REM run on windows as admin
REM source https://superuser.com/questions/1298510/how-can-i-prevent-windows-8-1-overwriting-my-bootloader?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
bcdedit /set {bootmgr} path \EFI\refind\refind_x64.efi
bcdedit /set {bootmgr} description REFIND
@mysiar
mysiar / Api-Platform_and_ DataTable.md
Created October 1, 2018 20:11
Api-Platform - DataTable

api-platform/api-platform#845 (comment)

Just to let you know: it seems the easiest way was to reorder the JSON response on the client side, using the dataFilter setting in jQuery.ajax():

$('#mytable').DataTable({
        'serverSide': true,
        'ajax': {
            'url': '/api/my_api',
            'headers': { 'Accept': "application/ld+json" },
 'dataFilter' : function (data) {
@mysiar
mysiar / replaceElementNodeValue.js
Created November 14, 2018 17:53
replaceElementNodeValue
/*
replaceElementNodeValue
this function works if only ONE element with nodeClass is found
element - DOM element with nested different elements
nodeClass - class of node that value we want to replace
nodeNewValue - selfexplaining
*/
@mysiar
mysiar / garmin-iq-sdk-ubuntu-18.04.md
Last active March 26, 2022 11:11
Garmin IQ SDK on Ubuntu 18.04
@mysiar
mysiar / ideolog-monolog.md
Created February 22, 2019 18:15
Monolog template for Ideolog
Message pattern: `^\[(.*)\] (.+?)\.([A-Z]+): (.*)`
Message start pattern: `^\[`
Time format: `yyyy-MM-dd HH:mm:ss`
Time capture group: `1`
Severity capture group: `3`
Category capture group: `2`
@mysiar
mysiar / CsvIterator.php
Created April 2, 2019 09:34
CsvIterator
<?php
declare(strict_types=1);
namespace mysiar;
use Exception;
use Iterator;
class CsvIterator implements Iterator
{
@mysiar
mysiar / DoctrineFixtures.md
Last active October 8, 2019 08:36
Doctrine Fixtures

Doctrine fixtures in different place than src/DataFixtures

  1. fixtures directory tree (example)

    tests/Fixtures/Data
    tests/Fixtures/Test
    
  2. all fixtures implements FixtureGroupInterface, Data fixtures return data, Test fixtures return test

  3. loading fixtures

@mysiar
mysiar / RamseyUuid.md
Created March 18, 2020 12:32
RamseyUuid
/**
     * @ORM\Column(type="uuid")
     * @ORM\GeneratedValue(strategy="CUSTOM")
     * @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator")
     * @ORM\Id()
     *
     * @var \Ramsey\Uuid\Uuid
     */
 protected $id;