Skip to content

Instantly share code, notes, and snippets.

import _ from 'lodash'
import qs from 'qs'
// @see https://www.contentful.com/developers/docs/references/images-api/#/reference/resizing-&-cropping/specify-width-&-height
const CONTENTFUL_IMAGE_MAX_SIZE = 4000
const isImage = image =>
_.includes(
[`image/jpeg`, `image/jpg`, `image/png`, `image/webp`, `image/gif`],
_.get(image, `file.contentType`)
)
@bjo3rnf
bjo3rnf / webpack.config.js
Created August 14, 2019 16:31
Tailwind CSS in a Symfony Project with Webpack Encore and Purge CSS
const Encore = require('@symfony/webpack-encore');
const tailwindcss = require('tailwindcss');
const autoprefixer = require('autoprefixer');
const purgecss = require('@fullhuman/postcss-purgecss')({
content: [
'./templates/**/*.twig',
'./assets/js/**/*.vue',
'./assets/js/**/*.js',
@Berbass
Berbass / DiscriminatorEntry.php
Last active October 5, 2016 15:56 — forked from jasperkuperus/DiscriminatorListener.php
Had some issues with the original version on this gist https://gist.github.com/jasperkuperus/03302fefe6e4722ab650 , so I made some changes. This code also works if using abstract MappedSuperClass.
<?php
namespace Namespace\That\Suits\You;
/**
* @Annotation
* @Target("CLASS")
*/
class DiscriminatorEntry implements \Doctrine\ORM\Mapping\Annotation
{
@webdevilopers
webdevilopers / RecentContractsBlockService.php
Last active June 3, 2021 08:34
Sonata Admin - Include custom block / list view in edit template
<?php
namespace Plusquam\Bundle\ContractBundle\Block;
use Sonata\BlockBundle\Block\BlockContextInterface;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
use Symfony\Component\HttpFoundation\Response;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Validator\ErrorElement;
@lavoiesl
lavoiesl / AbstractFixtureMigration.php
Last active October 18, 2023 19:23
Load Doctrine Fixtures when using Migrations in Symfony: AbstractFixtureMigration
<?php
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Symfony\Bridge\Doctrine\DataFixtures\ContainerAwareLoader as Loader;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@Kalyse
Kalyse / schema.json
Last active August 29, 2015 14:10
Schema Property
{
"id": "1",
"name": "Belle Vista",
"active": true,
"meta": {
"externalBookNowUrl": "https://www.bookingpage.com/payments/id/1234",
"events": {
"enquiry": [
{
"strategy": "email",
@stdavis
stdavis / ExampleUsage.js
Last active February 11, 2024 23:04
AMD Loader For Ignoring Modules in Dojo Build
require(['IgnoreModule!module/to/Ingore'], function (Ignore) {...});
@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active April 17, 2024 10:51
Backend Architectures Keywords and References
@lukegb
lukegb / gist:5228290
Last active December 15, 2015 08:09
duggan's list of Yahoo Message AMIs
16:04:43 <duggan> N. Virginia: ami-2400984d
16:04:43 <duggan> Ireland: ami-d8d2d8ac
16:04:43 <duggan> Tokyo: ami-a361e1a2
16:04:43 <duggan> Singapore: ami-6e703c3c
16:04:43 <duggan> Sydney: ami-4e0e9f74
16:04:45 <duggan> Sao Paolo: ami-9d7aa180
16:04:48 <duggan> N. California: ami-94f6dbd1
16:04:50 <duggan> Oregon: ami-cf9206ff
NB: your username goes in the user data field
@avar
avar / git-untracked-file-committer.pl
Created August 23, 2012 19:47
A utility to commit untracked files in repository A to repository B
#!/usr/bin/env perl
use strict;
use warnings;
use autodie qw(:all);
use Data::Dumper;
use Getopt::Long;
# How to run this:
# 1. Clone this gist into ~/g/gist-git-untracked/
# 2. git init ~/g/to-repository