Skip to content

Instantly share code, notes, and snippets.

@antonioribeiro
antonioribeiro / php80-buster.dockerfile
Created June 7, 2021 15:31
Laravel Vapor on Debian Buster
FROM php:8.0-fpm-buster
# Install `docker-php-ext-install` helper to ease installation of PHP
# extensions
#
# Ref: https://github.com/mlocati/docker-php-extension-installer
ENV PHP_EXT_INSTALLER_VERSION=1.2.26
RUN set -eux; \
curl --fail -Lo /usr/local/bin/install-php-extensions \
// in your .env file, split APP_URL to extract protocol and hostname
APP_PROTOCOL=https
APP_HOSTNAME=myapp.test
APP_URL="${APP_PROTOCOL}://${APP_HOSTNAME}"
// install dotenv
npm install dotenv
function in($needle, ...$haystack): bool
{
foreach ($haystack as $hay) {
if ((is_array($hay) && in($needle, ...$hay)) || $needle == $hay) {
return true;
}
}
return false;
}
Route::get('/sign-async-setasign', function () {
// Define the path to the OpenSSL executable
// $opensslPath = 'C:\\OpenSSL-Win32\\bin\\';
$opensslPath = '/usr/bin/';
// require SetaPDF
// require_once 'library/SetaPDF/Autoload.php'; // we are using Composer
date_default_timezone_set('Europe/Berlin');
@antonioribeiro
antonioribeiro / phpx.sh
Created January 23, 2018 19:59
phpx - run php without Xdebug
function phpx {
phpPath=/usr/local/etc/php/$PHP_VERSION
find $phpPath/php.ini $phpPath/conf.d/*.ini ! -name ext-xdebug.ini | xargs cat > $phpPath/php-no-xdebug.ini
php -n -c $phpPath/php-no-xdebug.ini "$@"
}
function clone () {
REPOSITORY=git@github.com:$1.git
echo "Cloning $REPOSITORY using SSH..."
git clone $REPOSITORY $2 2>/dev/null
if [[ $? -ne 0 ]]
then
REPOSITORY=https://github.com/$1.git
echo 'Falling back to HTTPS ($REPOSITORY)...'
git clone $REPOSITORY $2
# The path where you usually put your repositories on
export MKREPO_REPOSITORIES_BASE_PATH=~/code/
# The path where your initial files (README.md, LICENSE.md and .gitingore) are
export MKREPO_SKELETON_PATH=/Users/antoniocarlos/Dropbox/development/.skeleton/
function mkrepo {
#/
## Splash
#/
@extends('layouts.app')
@section('content')
<div class="container-fluid" id="vue-laws">
<div class="row">
<div class="col-md-10 col-md-offset-1">
<div class="panel panel-default">
<div class="panel-heading">Leis</div>
<div class="panel-body scrollable">
// Instead of
$instance1 = app($class, $parameters);
// or
$instance2 = app()->make($class, $parameters);
// or
#!/bin/bash
FILENAME="$1"
S3_KEY="YOUR-KEY"
S3_SECRET="YOUR-SECRET"
BUCKET="YOUR-BUCKET"
FILEPATH="DESTINATION-DIRECTORY/$file"
CONTENT_TYPE="application/octet-stream"
DATE_TIME="$(LC_ALL=C date -u +"%a, %d %b %Y %X %z")"
MD5="$(openssl md5 -binary < "$FILENAME" | base64)"
SIG="$(printf "PUT\n$MD5\n$CONTENT_TYPE\n$DATE_TIME\n/$BUCKET/$FILEPATH" | openssl sha1 -binary -hmac "$S3_SECRET" | base64)"