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 | |
$string = "This website is stupid. Your speaking style is idiotic. Your knowledge is crap.This is so stupid. You are an idiot. You are an IDIOT!"; | |
echo preg_replace('/stupid|idiot(?:ic)?|crap/i', 'amazing', $string) . PHP_EOL . PHP_EOL; | |
$website1 = 'www.laracasts.com'; | |
$website2 = 'alexrusin.com'; | |
echo preg_replace('/www\.([^\.]+)/i', '$1', $website1) . PHP_EOL; | |
echo preg_replace('/www\.([^\.]+)/i', '$1', $website2) . PHP_EOL . PHP_EOL; |
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
// package.json | |
{ | |
"private": true, | |
"scripts": { | |
"dev": "npm run development", | |
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", | |
"watch": "npm run development -- --watch", | |
"watch-poll": "npm run watch -- --watch-poll", | |
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", | |
"prod": "npm run production", |
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
APP_NAME=Websockets | |
APP_ENV=production | |
APP_KEY=base64:87fP6T6NYDlGthaKZoPUs6gcBHt+LoluOvs88TewC9BC | |
APP_DEBUG=true | |
APP_URL= | |
LOG_CHANNEL=stack | |
DB_CONNECTION=mysql | |
DB_HOST=db_ip_address |
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
FROM ubuntu:16.04 | |
MAINTAINER Alex Rusin | |
RUN apt-get update \ | |
&& apt-get install -y locales \ | |
&& locale-gen en_US.UTF-8 | |
ENV LANG en_US.UTF-8 | |
ENV LANGUAGE en_US:en |
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
[supervisord] | |
nodaemon=true | |
[program:websockets] | |
command=/usr/bin/php /var/www/html/artisan websockets:serve | |
numprocs=1 | |
autostart=true | |
autorestart=true | |
user=www-data |
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
// Console/Kernel.php | |
protected $commands = [ | |
Commands\MasterCommand::class, | |
Commands\CommandOne::class, | |
Commands\CommandTwo::class | |
]; | |
/** |
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 | |
if (!isset($_SERVER['REQUEST_URI']) || strtok($_SERVER["REQUEST_URI"],'?') !== '/greetings') { | |
http_response_code(404); | |
die(); | |
} | |
$name = $_GET['name'] ?? 'Anonymous'; | |
$greeting = $_GET['greeting'] ?? 'How do you do'; |
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
// https://dotdev.co/creating-unique-title-slugs-with-laravel/ | |
// https://andy-carter.com/blog/using-laravel-s-eloquent-traits | |
<?php | |
namespace App\Traits; | |
use Illuminate\Support\Str; | |
trait Sluggable |
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 SunriseIntegration\PeruConnector\Connector; | |
class RetryDecorator | |
{ | |
protected $connector; | |
protected $method; | |
protected $arguments = []; | |
protected $soapFaultRetries = 0; |
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
function makeCURLconnection($postURL, $curlTYPE, $dataToPost = null, $headerPOST = null) | |
{ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $postURL); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); | |
curl_setopt($ch, CURLOPT_VERBOSE, 1); | |
curl_setopt($ch, CURLOPT_HEADER, 0); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, '0'); |