Implementations of Enum type in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ "keys": ["shift+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line.sublime-macro"} }, | |
{ "keys": ["alt+up"], "command": "swap_line_up" }, | |
{ "keys": ["alt+down"], "command": "swap_line_down" }, | |
{ "keys": ["ctrl+alt+j"], "command": "join_lines" }, | |
{ "keys": ["ctrl+alt+down"], "command": "duplicate_line" }, | |
{ "keys": ["shift+ctrl+r"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} }, | |
{ "keys": ["ctrl+shift+s"], "command": "save_all" }, | |
{ "keys": ["ctrl+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} }, | |
{ "keys": ["shift+ctrl+f4"], "command": "close_all" }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'), | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$class = CActiveRecord::HAS_MANY; // Или любой другой вид отношений (HAS_ONE, BELONGS_TO, MANY_MANY) | |
$model->getMetaData()->relations[$relationName] = | |
new $class( | |
$relationName, | |
$className, | |
$foreignKey, | |
$options | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
public function rules() | |
{ | |
return array( | |
array('attributes, that, are, edited, by, user','filter', | |
'filter'=>array($obj=new CHtmlPurifier(),'purify')), | |
... | |
); | |
} | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
Built a new cool PHP library or wrote a blog post and want more people to see it?
Send me the link! @pronskiy
OlderNewer