This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc('Tail your laravel.log file'); | |
task('tail', function () { | |
$numLines = isVerbose() ? '100' : '1000'; | |
$tail = "tail -n {$numLines} {{deploy_path}}/current/storage/logs/laravel*.log "; | |
if (!isVerbose()) { | |
// Change -P to -E, depending on OS or grep version. | |
$tail .= '| grep -i -P "^\[\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}:\d{2}\]|Next [\w\W]+?\:" | tail -n 100 '; | |
} | |
$output = run($tail); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find ./media -mmin -1440 -type f -iname '*.gif' -exec sh -c 'gifsicle -b -O3 "{}"' \; | |
find ./media -mmin -1440 -type f -iname '*.png' -exec optipng -o7 -strip all -preserve '{}' \; | |
find ./media -mmin -1440 -type f -iname '*.jpg' -exec jpegoptim --strip-all -m85 -o -p {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FORGE CONFIG (DOT NOT REMOVE!) | |
include forge-conf/default/before/*; | |
upstream fastcgi_backend { | |
server unix:/var/run/php/php7.1-fpm.sock; | |
} | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
class ForceHttps | |
{ | |
/** | |
* Force non-local requests to be HTTPS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Libraries; | |
use ReflectionClass; | |
use ReflectionMethod; | |
use Illuminate\Support\Str; | |
/** | |
* @deprecated since version 5.2. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Turn off all options we don't need. | |
Options None | |
Options +FollowSymLinks | |
# Set the catch-all handler to prevent scripts from being executed. | |
SetHandler Security_Do_Not_Remove_This_Line | |
<Files *> | |
# Override the handler again if we're run later in the evaluation list. | |
SetHandler Security_Do_Not_Remove_This_Line | |
</Files> | |
# If we know how to do it safely, disable the PHP engine entirely. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html dir="ltr"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | |
<title>Google Doc viewer</title> | |
<style type="text/css"> | |
body, html { | |
margin: 0; padding: 0; height: 100%; overflow: hidden; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Csv | |
{ | |
public static function fromArray($rows, $delimiter = ',') | |
{ | |
if (empty($rows)) { | |
return ''; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use SimpleXMLElement; | |
class Xml { | |
/** | |
* @param array $data | |
* @param string $root | |
* @return SimpleXMLElement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
echo "Running tests.. "; | |
exec('vendor/bin/phpunit', $output, $returnCode); | |
if ($returnCode !== 0) { | |
// Show full output | |
echo PHP_EOL . implode($output, PHP_EOL) . PHP_EOL; | |
echo "Cannot push changes untill tests are OK.." . PHP_EOL; | |
exit(1); | |
} |