Skip to content

Instantly share code, notes, and snippets.

View pierre-H's full-sized avatar
🇫🇷
Cultive son jardin

Pierre pierre-H

🇫🇷
Cultive son jardin
  • Strasbourg, France
View GitHub Profile
@tezvi
tezvi / DefaultOrderExtensionDecorator.php
Last active September 4, 2024 11:51
Prevent duplicate SQL order when combining ApiPlatform default resource order and order filters
<?php
/**
* @author Andrej Vitez <[email protected]>
* @licence MIT
*/
declare(strict_types=1);
namespace Acme\ApiPlatform\Extension;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\ContextAwareQueryCollectionExtensionInterface;
@ywwwtseng
ywwwtseng / host-react-app-on-apache-server.md
Last active October 28, 2024 19:15
Host react application on Apache server

Host react application on Apache server

Step 1 : Create your app

$ npm install -g create-react-app 
$ create-react-app my-app

Step 2 : Build it for production

@pierre-H
pierre-H / declarations.d.ts
Created January 23, 2017 09:12
Admin On Rest - Typescript declaration
declare module 'admin-on-rest' {
function jsonServerRestClient(url: string): Promise<{type: string, resource: string, param: {}}>;
class Admin extends React.Component<{
restClient: Promise<{type: string, resource: string, param: {}}>,
title ?: string,
dashboard?: React.Component<void, void>,
theme?: __MaterialUI.Styles.MuiTheme,
appLayout?: React.Component<void, void>
}, void> {}
@pierre-H
pierre-H / index.html
Last active August 24, 2016 15:36
JQuery : conditional field depending on another field
<form>
<select id="my-select">
<option value="1">1</option>
<option value="2">2</option>
</select>
<input type="text" data-conditional="my-select" data-conditional-on="1" />
</form>
@mylk
mylk / CountryExtension.php
Last active March 25, 2019 13:49
Twig extension that adds a filter that returns the country name by its 2-letter ISO code
<?php
/*
* Installation:
* =============
* # services.yml
* services:
* # ...
* acme.twig.country_extension:
* class: Acme\AcmeBundle\Twig\CountryExtension
@julianxhokaxhiu
julianxhokaxhiu / pagespeed_optimize_images.sh
Last active June 15, 2024 17:09
Recursively optimize all PNG and JPG files wherever they are from the script position and inner ( based on OPTING, PNGCRUSH, ADVANCECOMP and JPEGOPTIM )
#!/bin/bash
# Improved as per feedback from @pascal - https://gist.github.com/julianxhokaxhiu/c0a8e813eabf9d6d9873#gistcomment-3086462
find . -type f -iname "*.png" -exec optipng -nb -nc {} \;
find . -type f -iname "*.png" -exec advpng -z4 {} \;
find . -type f -iname "*.png" -exec pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow {} \;
find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -exec jpegoptim -f --strip-all {} \;