Skip to content

Instantly share code, notes, and snippets.

View edutrul's full-sized avatar
💭
Changing the world

Eduardo Telaya edutrul

💭
Changing the world
View GitHub Profile
@edutrul
edutrul / Script.luau
Created April 12, 2026 04:52
Advanced lifecycle
print("Hello world!")
local Players = game:GetService("Players")
local tool = script.Parent
local handle = tool:WaitForChild("Handle")
local onTouched = function(basePart: BasePart)
print("onTouched", basePart.Name)
local character = basePart:FindFirstAncestorOfClass("Model")
if not character then return end
@edutrul
edutrul / for.luau
Created April 12, 2026 02:55
For luau explained
local fruits = {"fruits", "apple", "orange"}
print(fruits[1])
for index, value in ipairs(fruits) do
print (index, value)
end
for index, value in pairs(fruits) do
print (index, value)
end
@edutrul
edutrul / killer-innocent-gpt.luau
Last active April 12, 2026 04:43
Roblox users joining
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local KNIFE_NAME = "Knife"
local HIGHLIGHT_NAME = "KillerHighlight"
local innocentPlayer: Player?
local killerPlayer: Player?
@edutrul
edutrul / HomepageTest.php
Last active April 6, 2026 03:35
Best practices for SeleniumTestDriver which unfortunately there's no support yet in DTT as that should use the new driver WebDriver instead. So here's a workaround.
<?php
declare(strict_types=1);
namespace Drupal\Tests\server_general\ExistingSite;
use Symfony\Component\HttpFoundation\Response;
/**
* Tests for the Homepage.
@edutrul
edutrul / EntityBundleTestBase.php
Last active April 6, 2026 03:35
How to deal with DTT with a specific paragraph like "Quote" and the correct parent classes following best practices.
<?php
declare(strict_types=1);
namespace Drupal\Tests\server_general\ExistingSite;
use Drupal\Tests\drupal_test_assertions\Assertions\EntityTrait;
use Drupal\Tests\drupal_test_assertions\Assertions\FieldsTrait;
use weitzman\DrupalTestTraits\ExistingSiteBase;
@edutrul
edutrul / FileCreationTrait.php
Created April 6, 2026 02:25
FileCreationTrait for DTT how this should be done very solid.
<?php
declare(strict_types=1);
namespace Drupal\Tests\server_general\Traits;
use Drupal\Core\File\FileExists;
use Drupal\file\FileInterface;
use weitzman\DrupalTestTraits\DrupalTrait;
@edutrul
edutrul / anonymous_functions.lua
Last active April 10, 2026 22:48
Script sample to learn luau
local sayHello = function ()
print("Say something")
end
print (sayHello())
print((function ()
print('gosh')
end
@edutrul
edutrul / README.md
Created March 31, 2026 17:58
Claude Code + DDEV: Auto-run PHPCS after every file edit (PostToolUse hook for Drupal projects)

Claude Code + DDEV: Auto-run PHPCS on every file edit

A Claude Code PostToolUse hook that automatically runs PHPCS after Claude edits a PHP/Drupal file inside a DDEV project — feeding violations back to Claude so it can self-correct without any human intervention.

What it does

  • Fires after every Edit or Write tool use
  • Checks only PHP-family files: .php, .module, .install, .inc, .theme
@edutrul
edutrul / class08.php
Created April 25, 2025 21:54
Clase Robot php
<?php
class Robot {
private $size;
private $color;
private $price;
function __construct($size, $color, $price) {
@edutrul
edutrul / arrays-session-4.php
Last active April 10, 2025 22:07
Session 04 - Loops and Arrays
<?php
$movies = [
'Harry Potter I',
'Star Wars V',
'One Piece movie',
'Titanic',
'Frozen III',
'Exorcista 2025',
];