Skip to content

Instantly share code, notes, and snippets.

Antonio Carlos Ribeiro antonioribeiro

Block or report user

Report or block antonioribeiro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View samesite.php
// 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
View in.php
function in($needle, ...$haystack): bool
{
foreach ($haystack as $hay) {
if ((is_array($hay) && in($needle, ...$hay)) || $needle == $hay) {
return true;
}
}
return false;
}
View sign.php
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 Jan 23, 2018
phpx - run php without Xdebug
View phpx.sh
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 "$@"
}
View clone
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
View mkrepo.sh
# 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
#/
View vue-laws
@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">
View app.php
// Instead of
$instance1 = app($class, $parameters);
// or
$instance2 = app()->make($class, $parameters);
// or
View upload-to-s3.sh
#!/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)"
View trans.php
Blade::extend(function ($view) {
return preg_replace(
'/{{(\'|")(.*)(\'|")}}/',
'<?php echo e(trans($1$2$1)); ?>',
$view
);
});
// And you should be able to do tho this on your Blade templates
You can’t perform that action at this time.