Skip to content

Instantly share code, notes, and snippets.

View micc83's full-sized avatar

Alessandro Benoit micc83

View GitHub Profile
@khalidx
khalidx / node-typescript-esm.md
Last active April 22, 2024 15:40
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@Ocramius
Ocramius / handling-optional-input-fields-with-type-safe-abstractions.md
Last active March 17, 2023 12:06
Handling optional input parameters in PHP with `vimeo/psalm` and `azjezz/psl`

Handling optional input parameters in PHP with vimeo/psalm and azjezz/psl

I had an interesting use-case with a customer for which I provide consulting services: they needed multiple fields to be marked as "optional".

Example: updating a user

We will take a CRUD-ish example, for the sake of simplicity.

For example, in the following scenario, does a null $description mean "remove the description",

@renalpha
renalpha / DockerFile
Last active January 5, 2024 16:04
Traefik
FROM php:7.4-fpm
RUN apt-get update && apt-get install -y libldb-dev libldap2-dev libzip-dev libpng-dev libjpeg62-turbo-dev libfreetype6-dev \
&& docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ \
&& docker-php-ext-install -j$(nproc) zip pdo pdo_mysql gd ldap pcntl opcache
@bergmannjg
bergmannjg / rearct-native-app-in-wsl2.md
Last active April 21, 2024 07:42
Building a react native app in WSL2
@dalezak
dalezak / README.md
Last active September 11, 2023 09:51
Ionic Capacitor Resources Generator
  1. Run npm install cordova-res --save-dev
  2. Create 1024x1024px icon at resources/icon.png
  3. Create 2732x2732px splash at resources/splash.png
  4. Add "resources": "cordova-res ios && cordova-res android && node scripts/resources.js" to scripts in package.json
  5. Copy resources.js file to scripts/resources.js
  6. Run sudo chmod -R 777 scripts/resources.js
  7. Run npm run resources
@anthonny
anthonny / webpack.config.js
Created March 15, 2019 14:38
Use dotenv with NativeScript
// ...
const dotenv = require("dotenv");
// ...
console.log(`Bundling application for entryPath ${entryPath}...`);
dotenv.config()
const isUppercase = key => key.toUpperCase() === key;
const envKeys = Object.keys(env);
@jjvillavicencio
jjvillavicencio / setup.sh
Last active April 22, 2024 21:22
Install Android SDK on Windows Bash (WSL)
cd /home/<user>/
sudo apt-get install unzip
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip -d Android
rm sdk-tools-linux-4333796.zip
sudo apt-get install -y lib32z1 openjdk-8-jdk
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$PATH:$JAVA_HOME/bin
printf "\n\nexport JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64\nexport PATH=\$PATH:\$JAVA_HOME/bin" >> ~/.bashrc
cd Android/tools/bin
@BenSampo
BenSampo / deploy.sh
Last active April 20, 2024 23:54
Laravel deploy script
# Change to the project directory
cd $FORGE_SITE_PATH
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin $FORGE_SITE_BRANCH
@adampatterson
adampatterson / sample.php
Created October 18, 2017 00:50
Whoops PHP Storm Config
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
@calebporzio
calebporzio / PreviewOfUpcomingPackage.php
Last active April 16, 2024 06:26
A model trait that allows child models to use parent table names and relationship keys.
<?php
namespace App\Abilities;
use Illuminate\Support\Str;
use ReflectionClass;
/**
* Note: This is a preview of an upcoming package from Tighten.
**/