Skip to content

Instantly share code, notes, and snippets.


Tamas Erdelyi terdelyi

View GitHub Profile
terdelyi / craft_custom_model_validation.php
Last active Jul 11, 2018
CraftCMS 3 - Custom model validation
View craft_custom_model_validation.php
// CraftCMS3 is using Yii2 framework which doesn't have a decoupled validator class.
// If you create a dummy model filled with the attributes coming from a POST request
// you can use custom validations for the incoming attributes.
$testPostData = [
'name' => 'Tamas Erdelyi',
'email' => ''
terdelyi / craft_validate_public_user_registration.php
Last active Sep 11, 2021
CraftCMS 3 - Extending the validation on the public user registration form
View craft_validate_public_user_registration.php
use Craft;
use craft\base\Element;
use craft\elements\User;
use craft\events\ModelEvent;
use yii\base\Event;
terdelyi /
Last active Jul 11, 2018
CraftCMS3 - Fixing default directory permissions
sudo chgrp -R www-data storage public/cpresources public/uploads
sudo chmod -R ug+rwx storage public/cpresources public/uploads
terdelyi / SleepTimer.scpt
Last active Mar 7, 2022
If you're watching Netflix in a browser (ex. Chrome) and you need a sleep timer this AppleScript is made for you.
View SleepTimer.scpt
display dialog "When do you want to sleep your computer? (in minutes)" default answer "60"
delay (text returned of the result) * 60
tell application "Google Chrome"
end tell
tell application "Finder"