Skip to content

Instantly share code, notes, and snippets.

View rentalhost's full-sized avatar

David Rodrigues rentalhost

  • Rentalhost.net
  • Rio de Janeiro, Brasil
View GitHub Profile
@rentalhost
rentalhost / array_subtract.php
Created October 15, 2020 16:15
array_subtract()
function array_subtract(array $source, array $subtractor)
{
foreach ($subtractor as $subtractorItem) {
$subtractorKey = array_search($subtractorItem, $source, true);
if ($subtractorKey !== false) {
unset($source[$subtractorKey]);
}
}
<?php
declare(strict_types = 1);
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Example
@rentalhost
rentalhost / .htaccess
Created April 15, 2016 17:51
www (medium)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteCond %{REQUEST_URI} !^/public/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /public/$1
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
@rentalhost
rentalhost / commands.sh
Created April 14, 2016 19:31
command.sh (medium)
/scripts/rebuildhttpdconf
service httpd restart
@rentalhost
rentalhost / index.php
Created April 14, 2016 19:28
index.php (medium)
<?
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://site.dominio.com/');