Skip to content

Instantly share code, notes, and snippets.

View terdelyi's full-sized avatar

Tamas Erdelyi terdelyi

View GitHub Profile
@terdelyi
terdelyi / SleepTimer.scpt
Last active March 7, 2022 16:30
If you're watching Netflix in a browser (ex. Chrome) and you need a sleep timer this AppleScript is made for you.
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"
quit
end tell
tell application "Finder"
sleep
@terdelyi
terdelyi / craft_default_permissions.sh
Last active July 11, 2018 09:14
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
terdelyi / craft_validate_public_user_registration.php
Last active September 11, 2021 03:18
CraftCMS 3 - Extending the validation on the public user registration form
<?php
use Craft;
use craft\base\Element;
use craft\elements\User;
use craft\events\ModelEvent;
use yii\base\Event;
@terdelyi
terdelyi / craft_custom_model_validation.php
Last active July 11, 2018 09:15
CraftCMS 3 - 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' => '[email protected]'
];