Skip to content

Instantly share code, notes, and snippets.

View canvural's full-sized avatar

Can Vural canvural

View GitHub Profile
diff --git a/lib/Doctrine/ruleset.xml b/lib/Doctrine/ruleset.xml
index c0bf70b..128acc9 100644
--- a/lib/Doctrine/ruleset.xml
+++ b/lib/Doctrine/ruleset.xml
@@ -144,8 +144,6 @@
<property name="linesCountBetweenUses" value="0"/>
</properties>
</rule>
- <!-- Forbid dead code -->
- <rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements"/>
void main() {
int a = 200;
if (a == 200) {
print('its 200');
}
int b = 400;
if (b == 200) {
@canvural
canvural / ValidateOpenAPISpec.php
Last active December 14, 2021 17:14
Laravel middleware to validate the incoming request against OpenAPI spec
<?php
declare(strict_types=1);
namespace App\Http\Middleware;
use Closure;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
diff --git a/src/Methods/EloquentBuilderForwardsCallsExtension.php b/src/Methods/EloquentBuilderForwardsCallsExtension.php
index cd212f3..35623d1 100644
--- a/src/Methods/EloquentBuilderForwardsCallsExtension.php
+++ b/src/Methods/EloquentBuilderForwardsCallsExtension.php
@@ -16,6 +16,7 @@ use PHPStan\Reflection\MethodsClassReflectionExtension;
use PHPStan\Reflection\ParametersAcceptorSelector;
use PHPStan\ShouldNotHappenException;
use PHPStan\Type\Generic\GenericObjectType;
+use PHPStan\Type\Generic\TemplateMixedType;
use PHPStan\Type\MixedType;
@canvural
canvural / app\twitter.html
Last active August 12, 2022 09:34 — forked from Radostin/twitter.html
Twitter Mockup with TailwindCSS
<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>Twitter</title>
<link rel="stylesheet" type="text/css" href="./css/tailwind.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
WITH ProductDiscounts (ProductName, Discount)
AS
(
SELECT p.Name, AVG(so.DiscountPct) as Discount FROM Production.Product p
JOIN Sales.SpecialOfferProduct sop ON p.ProductID = sop.ProductID
JOIN Sales.SpecialOffer so ON so.SpecialOfferID = sop.SpecialOfferID
WHERE so.DiscountPct > 0.0
GROUP BY p.Name
)
SELECT ProductName, (Discount*100) as disc