Skip to content

Instantly share code, notes, and snippets.

View Tynael's full-sized avatar
🎯
Focusing

Carol Pelu Tynael

🎯
Focusing
View GitHub Profile
@Tynael
Tynael / main.js
Created March 21, 2023 16:57
Find out if a web page has been rendered in Quirks mode or not
/*
Run this in your browser's console.
"BackCompat" - means the web page has been rendered in Quirks mode
"CSS1Compat" - the web page has NOT been rendered in Quirks mode
*/
document.compatMode
@Tynael
Tynael / with_doctype.html
Created March 21, 2023 16:39
Example of a web page rendered with and without DOCTYPE declaration
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>With DOCTYPE. NOT in Quirks mode.</title>
<style>
.styled {
color: red;
@Tynael
Tynael / HomeController.php
Last active January 26, 2023 16:59
How to Check If File Exists Using Laravel
<?php
declare(strict_types=1);
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\File;
class HomeController extends Controller
@Tynael
Tynael / HomeController.php
Last active January 26, 2023 16:59
How to Check If File Exists Using Laravel
<?php
declare(strict_types=1);
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Storage;
class HomeController extends Controller
@Tynael
Tynael / home.blade.php
Created January 18, 2023 16:06
How to Get Current URL Inside Blade Templates
<!DOCTYPE html>
<head></head>
<body>
<p>
<!-- Our URL: http://localvaren.com/home?param=neutrondev -->
<!--
Get the current URL
Output: http://localvaren.com/home
-->
@Tynael
Tynael / home.blade.php
Last active December 15, 2022 12:19
How to Set Variables in Blade Templates
<!DOCTYPE html>
<!-- ⚠️ DO NOT USE THIS ⚠️ -->
<?php
$name = 'John';
$last = 'Doe';
?>
<body>
<div>
<h1>{{ $name }}</h1>
@Tynael
Tynael / home.blade.php
Created December 15, 2022 12:05
How to Set Variables in Blade Templates
<!DOCTYPE html>
@php
$name = 'John';
$last = 'Doe';
@endphp
<body>
<div>
<h1>{{ $name }}</h1>
<h1>{{ $last }}</h1>
@Tynael
Tynael / home.blade.php
Created December 15, 2022 12:03
How to Set Variables in Blade Templates
<!DOCTYPE html>
<body>
<div>
<h1>{{ $name = 'John Doe' }}</h1>
</div>
</body>
</html>
@Tynael
Tynael / home.blade.php
Created December 15, 2022 12:02
How to Set Variables in Blade Templates
<!DOCTYPE html>
<body>
<div>
<h1>John Doe</h1>
</div>
</body>
</html>
@Tynael
Tynael / home.blade.php
Created December 15, 2022 11:42
How to Use Ternary Operator in Blade Templates
<!DOCTYPE html>
<body>
<div>
<h1>Route exists: {{ Route::has('login') ? 'Yes' : 'No' }}</h1>
</div>
</body>
</html>