Skip to content

Instantly share code, notes, and snippets.

🐘

Roman Pronskiy pronskiy

🐘
Block or report user

Report or block pronskiy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View PHP_DIGEST.MD

Built a new cool PHP library or wrote a blog post and want more people to see it?

Send me the link! @pronskiy

@pronskiy
pronskiy / readme.md
Created Oct 16, 2018 — forked from Rarst/WordPress.xml
WordPress Live Templates for PhpStorm
View readme.md
View Pretty git log
git config --global alias.lg '!git -c color.ui=always log --pretty=format:"%C(yellow)%h%Creset %C(green)%<(15,trunc)%an%Creset %C(cyan)%<(12,trunc)%ar%Creset %s" --graph -n20'
@pronskiy
pronskiy / fancy git log
Last active Aug 2, 2017
Fancy git log alias
View fancy git log
git config --global alias.lg '!f() { git -c color.ui=always log --pretty=format:"%C(yellow)%h%Creset %C(green)%<(15,trunc)%an%Creset %C(cyan)%<(12,trunc)%ar%Creset %s" --graph -n20 $@ | sed -e "s/\[[-A-Z0-9]*\]/$(tput setaf 172)&$(tput sgr0)/g"; }; f'
@pronskiy
pronskiy / update
Created Jul 17, 2015
Git update hook - commit message format
View update
#!/bin/sh
ref_to_check="refs/heads/dev"
commit_format="^\[(NG|KWAPI|KWUI|KEC|KWSRV)-[1-9]+\]\s"
refname="$1"
oldrev="$2"
newrev="$3"
echo "Enforcing Policies..."
@pronskiy
pronskiy / PHP Enums.md
Last active Feb 10, 2019
PHP Enums - Available implementations of Enum type in PHP
@pronskiy
pronskiy / DynamicRelationBehavior.php
Created Sep 5, 2012
Yii DynamicRelationBehavior
View DynamicRelationBehavior.php
class DynamicRelationBehavior extends CActiveRecordBehavior
{
/**
* @var string name of the relation which will be added to the owner dynamically
*/
public $relationName = 'posts';
public function afterFind($event)
{
$this->addRelation();
@pronskiy
pronskiy / gist:3635771
Created Sep 5, 2012
Yii CActiveRecord dynamic relation adding
View gist:3635771
$class = CActiveRecord::HAS_MANY; // Или любой другой вид отношений (HAS_ONE, BELONGS_TO, MANY_MANY)
$model->getMetaData()->relations[$relationName] =
new $class(
$relationName,
$className,
$foreignKey,
$options
);
@pronskiy
pronskiy / gist:3635739
Created Sep 5, 2012
CActiveRecord classic relation adding
View gist:3635739
class User extends CActiveRecord
{
public function relations()
{
return array(
'posts'=>array(self::HAS_MANY, 'Post', 'author_id'),
'profile'=>array(self::HAS_ONE, 'Profile', 'owner_id'),
);
}
@pronskiy
pronskiy / gist:3635704
Created Sep 5, 2012
XSS protection on Yii
View gist:3635704
...
public function rules()
{
return array(
array('attributes, that, are, edited, by, user','filter',
'filter'=>array($obj=new CHtmlPurifier(),'purify')),
...
);
}
...
You can’t perform that action at this time.