Skip to content

Instantly share code, notes, and snippets.

View romaricdrigon's full-sized avatar

Romaric Drigon romaricdrigon

  • Lausanne, Switzerland
View GitHub Profile
@faizanakram99
faizanakram99 / MonospaceResponse.php
Created November 18, 2020 12:02
View Monolog in browser with HttpFoundation component
<?php
declare(strict_types=1);
namespace Qbil\CommonBundle\Extension;
use Symfony\Component\HttpFoundation\Response;
use Webmozart\Assert\Assert;
final class MonospaceResponse extends Response
@pomber
pomber / timeago.js
Created February 14, 2020 17:22
Get a time ago human friendly string from a date (like dates in twitter).
const MINUTE = 60,
HOUR = MINUTE * 60,
DAY = HOUR * 24,
YEAR = DAY * 365;
function getTimeAgo(date) {
const secondsAgo = Math.round((+new Date() - date) / 1000);
if (secondsAgo < MINUTE) {
return secondsAgo + "s";
@vudaltsov
vudaltsov / FixPostgreSQLDefaultSchemaListener.php
Last active June 27, 2024 16:45
Doctrine PostgreSQL Default Schema Fix For Symfony
<?php
declare(strict_types=1);
namespace App\Doctrine\EventListener;
use Doctrine\DBAL\Schema\PostgreSQLSchemaManager;
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
final class FixPostgreSQLDefaultSchemaListener
@webbertakken
webbertakken / DtoUniqueEntity.php
Last active May 2, 2024 10:21
DataTransferObject-UniqueEntityConstraint
<?php
namespace App\Validator\Constraints;
use Symfony\Component\Validator\Constraint;
/**
* @Annotation
*/
class DtoUniqueEntity extends Constraint
@jdecool
jdecool / behat.yml
Created May 7, 2017 10:39
Use Chrome Headless with Behat
default:
extensions:
Behat\MinkExtension:
base_url: http://localhost:8000
default_session: selenium2
selenium2:
browser: chrome
wd_host: http://127.0.0.1:4444/wd/hub
capabilities:
chrome:
@mjj2000
mjj2000 / get-current-git-tag.sh
Last active June 4, 2024 14:55
[GIT] Get tag of current branch(that is HEAD) or fallback to short commit hash(7 digits) by single shell command
git describe --exact-match --tags 2> /dev/null || git rev-parse --short HEAD
@varyonic
varyonic / Dockerfile
Created June 10, 2016 14:14
Dockerfile with chromedriver
# See https://codeship.com/documentation/docker/browser-testing/
FROM myapp:base
# We need wget to set up the PPA and xvfb to have a virtual screen and unzip to install the Chromedriver
RUN apt-get install -y wget xvfb unzip
# Set up the Chrome PPA
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
@breiter
breiter / Markdown.mdimporter.patch
Last active October 30, 2023 10:24
Enable Spotlight indexing of Markdown in ~~El Capitan~~ Monterey without disabling SIP
--- /System/Library/Spotlight/RichText.mdimporter/Contents/Info.plist 2022-02-26 09:05:07.000000000 +0200
+++ /Library/Spotlight/Markdown.mdimporter/Contents/Info.plist 2022-03-22 21:01:30.000000000 +0200
@@ -13,27 +13,20 @@
<string>MDImporter</string>
<key>LSItemContentTypes</key>
<array>
- <string>public.rtf</string>
- <string>public.html</string>
- <string>public.xml</string>
- <string>public.plain-text</string>
@paulirish
paulirish / how-to-view-source-of-chrome-extension.md
Last active June 28, 2024 16:04
How to view-source of a Chrome extension

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

@mickaelandrieu
mickaelandrieu / upgrade2.3-to-2.7.md
Last active May 21, 2024 03:39
Complete migration guide from Symfony 2.3 LTS to Symfony 2.7 LTS

From Symfony 2.3 to Symfony 2.7: the complete guide

Objectives

  • assume your code doesn't use any deprecated from versions below Symfony 2.3
  • update dependencies from 2.3 to 2.7
  • do not support "deprecated", be "Symfony3-ready"
  • list tasks component by component, bundle by bundle.