Skip to content

Instantly share code, notes, and snippets.

View felixdorn's full-sized avatar

Félix Dorn felixdorn

View GitHub Profile
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<title>
</title>
<!--[if !mso]><!-->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--<![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
{
"name": "me/crawler",
"autoload": {
"psr-4": {
"Me\\Crawler\\": "src/"
}
},
"authors": [
{
"name": "Félix Dorn",
@felixdorn
felixdorn / whole_numbers_array.php
Created August 23, 2021 14:04
numbers in literal form from 1 to 60
[
1 => 'one',
2 => 'two',
3 => 'three',
4 => 'four',
5 => 'five',
6 => 'six',
7 => 'seven',
8 => 'eight',
9 => 'nine',
@felixdorn
felixdorn / punctuation_signs.php
Created May 12, 2021 16:24
An array of all punctuation signs
$punctuationSigns = ['!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`', '{', '|', '}', '~']
Blade::directive('alpine', function (string $variables) {
return <<<PHP
<?php
\$data = array_combine(
array_map(
fn (\$variable) => str_replace('$', '', \$variable),
explode(',', '$variables')
),
[$variables]
);
import re
PRECEDENCES = {'+': 2, '-': 2, '*': 3, '/': 3, '^': 4}
def has_greater_precedence(operator, comparison):
return PRECEDENCES[operator] > PRECEDENCES[comparison]
def peek(stack):
import math
def find_roots(a, b, c):
if a == 0:
return print('Erreur: a est égal à 0.')
delta = b ** 2 - 4 * a * c
print()
@felixdorn
felixdorn / css_colors.tinkerwell.php
Last active June 29, 2020 12:30
A list of built-in CSS colors
$page = Http::get('https://www.w3schools.com/cssref/css_colors.asp')->body();
$html = new Symfony\Component\DomCrawler\Crawler($page);
$names = [];
foreach($html->filter('#colornamestable .colornamespan') as $element) {
$names[] = strtolower($element->firstChild->firstChild->wholeText);
}
$values = [];
<?php
namespace Kadevland\Eloquent\Uuid\Traits;
use Kadevland\Eloquent\Uuid\Contracts\UuidGeneratorString;
use Kadevland\Eloquent\Uuid\Generators\RamseyUuid4;
trait HasUuidString
{
.input {
@apply bg-white rounded-lg w-full max-w-lg px-6 border border-gray-300 py-3 mt-2;
&::placeholder {
@apply text-gray-dark;
}
&:focus {
@apply border-opacity-0 outline-none shadow-outline-blue;
}