Skip to content

Instantly share code, notes, and snippets.

View fedetibaldo's full-sized avatar
🌱
Living, I guess

Federico Tibaldo fedetibaldo

🌱
Living, I guess
View GitHub Profile
@fedetibaldo
fedetibaldo / resize-photos.ts
Last active April 21, 2023 14:51
Requires the imagemagick CLI tool.
import { readdir } from 'fs/promises';
import path from 'path';
import im from 'imagemagick';
import { promisify } from 'util';
const PHOTOS_PATH = path.join(process.cwd(), '/public/assets/photos/');
const MAX_WIDTH = 1920;
const identifyWidth = promisify(
(filePath: string, callback: (err: any, result: string) => void) => {
@fedetibaldo
fedetibaldo / any.php
Created September 18, 2020 08:38
Get Current Language ISO Code in TYPO3
<?php
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Utility\GeneralUtility;
// ...
$context = GeneralUtility::makeInstance(Context::class);
/** @var TYPO3\CMS\Core\Site\Entity\Site */
@fedetibaldo
fedetibaldo / profiles.json
Last active November 7, 2021 16:50
Windows Terminal Settings
// This file was initially generated by Windows Terminal 1.11.2921.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@fedetibaldo
fedetibaldo / script.sh
Created November 26, 2019 21:34
How to test composer create-project with a local repository
composer create-project vendor/package test-install \
--repository "{ \"type\": \"git\", \"url\": \"path\/to\/.git\" }" \
--stability dev
# postgresql
sudo apt install postgresql-11
sudo apt install postgresql-server-dev-11
# dependencies
sudo apt install libxml2-dev
sudo apt install libgeos-dev
sudo apt install libproj-dev
sudo apt install libgdal-dev
@fedetibaldo
fedetibaldo / debug.css
Created September 11, 2019 20:16
Simple debug rule
*, *::after, *::before {
outline: 1px solid red;
}
@fedetibaldo
fedetibaldo / gulpfile.js
Last active March 21, 2018 07:49
The minimum setup necessary to make puppeteer return the response body of a request
const gulp = require('gulp')
const puppeteer = require('puppeteer')
const err = (err) => console.log(err)
gulp.task('puppeteer', async (done) => {
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.goto('http://localhost/puppeteer/build/')
.then( async (response) => {
@fedetibaldo
fedetibaldo / hexhsl.php
Created January 27, 2018 22:18 — forked from bedeabza/hexhsl.php
PHP Hex to HSL and HSL to Hex conversion
<?php
function hexToHsl($hex) {
$hex = array($hex[0].$hex[1], $hex[2].$hex[3], $hex[4].$hex[5]);
$rgb = array_map(function($part) {
return hexdec($part) / 255;
}, $hex);
$max = max($rgb);
$min = min($rgb);