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 | |
// The Regular Expression filter | |
$reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; | |
// The Text that you want to filter for urls and links | |
$text = "The text that you want to filter is: https://github.com"; | |
// Check if there is a url in the text | |
if(preg_match($reg_exUrl, $text, $url)) { |
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
var randomColor = Math.floor(Math.random()*16777215).toString(16); |
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 | |
// This is what you might have right now | |
Route::get('users/{id}', 'UserController@getProfile')->where('id', '[\d+]+'); | |
Route::get('products/{id}', 'ProductController@getProfile')->where('id', '[\d+]+'); | |
Route::get('articles/{slug}', 'ArticleController@getFull')->where('slug', '[a-z0-9-]+'); | |
Route::get('faq/{slug}', 'FaqController@getQuestion')->where('slug', '[a-z0-9-]+'); | |
// and many more, now imagine you'll have to change the rule | |
// Instead, you could have a handy list of patterns and reuse them everywhere: | |
// Patterns |
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
<template> | |
<div> | |
<small>Change/Upload</small> | |
<input type="file" @change="onFileChange"> | |
<button class="btn btn-success btn-xs" @click="upload">Upload</button> | |
</div> | |
</template> |
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 | |
//define a route that in action validate signature | |
Route::get('signed', function (Request $request) { | |
if ( ! $request->hasValidSignature() ) { | |
abort( 404 ); | |
}else{ | |
//do something | |
} | |
})->name('signed'); |
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
@media screen and (min-width: 320px) and (max-width: 767px) and (orientation: landscape) { | |
html { | |
transform: rotate(-90deg); | |
transform-origin: left top; | |
width: 100vh; | |
overflow-x: hidden; | |
position: absolute; | |
top: 100%; | |
left: 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
<script> | |
window.Laravel = @json([ | |
'csrfToken' => csrf_token(), | |
'baseUrl' => url('/'), | |
'routes' => collect(Route::getRoutes()) | |
->mapWithKeys(function ($route) { |
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 | |
//Faker offers a couple of methods that let you replace placeholders in a given string with random characters: | |
//lexify - takes given string and replaces ? with random letters | |
//asciify - takes given string and replaces * with random ascii characters | |
//numerify - takes given string and replaces # with random digits | |
//bothify - combines the lexify and numerify | |
//You could try to use one of them, depending on the requirements you have for that random string you need. asciify uses the largest set of characters as replacement so using that one makes most sense. | |
//The following will give you a random string of 20 ascii characters: |
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
@ECHO OFF | |
cls | |
:loop | |
cls | |
:enterPort | |
cls | |
set /P port="Enter a port. [ q => exit ] : " | |
If "%port%"=="q" goto endLoop | |
cls | |
echo. |
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 Cors | |
{ | |
/** | |
* Handle an incoming request. |