Skip to content

Instantly share code, notes, and snippets.

View emulienfou's full-sized avatar
🏠
Working from home

David Sanchez emulienfou

🏠
Working from home
View GitHub Profile
// Convert PX to REM
$browser-context: 16; // Default
@function rem($pixels, $context: $browser-context) {
@return #{$pixels/$context}rem;
}
// Margin/Padding helpers
$step : 5;
$from : 0;
$through : ceil( 100 /$step);
@emulienfou
emulienfou / AdminController.php
Last active August 21, 2018 17:43
EasyAdmin role based permissions
<?php
namespace Acme\Controller;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AdminController as BaseAdminController;
use EasyCorp\Bundle\EasyAdminBundle\Exception\ForbiddenActionException;
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
use Symfony\Component\Routing\Annotation\Route;
/**
@emulienfou
emulienfou / Dockerfile
Last active January 16, 2020 16:06
Docker PHP-FPM 7.3.10, Nginx, MySQL
FROM php:7.3.10-fpm-alpine AS PHP
# persistent / runtime deps
RUN apk add --no-cache \
acl \
fcgi \
file \
gettext \
git \
;
@emulienfou
emulienfou / wavesurfer-soundcloud.js
Created December 7, 2022 15:37
WaveSurfer SoundCloud rendered
const playButton = document.querySelector('#playButton')
const playButtonIcon = document.querySelector('#playButtonIcon')
const waveform = document.querySelector('#waveform')
const volumeIcon = document.querySelector('#volumeIcon')
const volumeSlider = document.querySelector('#volumeSlider')
const currentTime = document.querySelector('#currentTime')
const totalDuration = document.querySelector('#totalDuration')
const ctx = document.createElement('canvas').getContext('2d')
const linGrad = ctx.createLinearGradient(0, 0, 0, 140)