Skip to content

Instantly share code, notes, and snippets.

View yupe's full-sized avatar
🤔

Yupe! team yupe

🤔
View GitHub Profile
@yupe
yupe / yupe-menu.php
Last active August 26, 2015 12:01
Yupe menu widget
$this->widget('application.modules.menu.widgets.MenuWidget', ['name' => 'top-menu-'.Yii::app()->language]);
<?php
namespace tests\_pages\user;
use yii\codeception\BasePage;
class LoginPage extends BasePage
{
public $route = 'account/login';
public function publish()
{
$transaction = Yii::app()->db->beginTransaction();
try
{
$this->status = self::STATUS_PUBLISHED;
$this->publish_date = date('d-m-Y h:i');
if($this->save()) {
Yii::app()->eventManager->fire(PostEvents::POST_PUBLISH, new PostPublishEvent($this, Yii::app()->getUser()));
@yupe
yupe / gist:8ec8e205ce7b6ce57600
Created June 5, 2014 10:47
EventDispatcher wrapper
<?php
namespace yupe\components;
use Symfony\Component\EventDispatcher\Event;
use Yii;
use CApplicationComponent;
use Symfony\Component\EventDispatcher\EventDispatcher;
class EventManager extends CApplicationComponent
{% extends "layouts/main.twig" %}
{% block title %}{{ post.title }}{% endblock %}
{% block description %}{{ post.getQuote() }}{% endblock %}
{% block keywords %}yii, yiiframework, юпи!, yupe, блог, записи{% endblock %}
{% block content %}
<section id="blog-post" class="light-bg">
<div class="container inner-top-sm inner-bottom classic-blog">
server {
server_name crm.local;
root /var/www/crm/web;
location / {
# try to serve file directly, fallback to app.php
try_files $uri /app.php$is_args$args;
}
location ~ ^/(app|app_dev|config|install)\.php(/|$) {
@yupe
yupe / gist:93fb9d66a94d97bccf27
Last active August 29, 2015 14:14
Yupe cms смена урлов панели управления
<?php
return [
'component' => [
'request' => [
'class' => 'yupe\components\HttpRequest',
// пути, исключенные из csrf-валидации
'noCsrfValidationRoutes' => ['admin/AjaxImageUpload', 'admin/AjaxFileUpload'],
]
],
numbers = [1, 2, 3, 4]
double_first(numbers)
print numbers
n = [3, 5, 7]
def double_list(x):
n.append('!')
print n
# Don't forget to return your new list!
print double_list(n)
@yupe
yupe / php-storm-format
Created September 14, 2011 13:14
До
$comment->setAttributes(array(
'userId' => Yii::app()->user->getId(),
'name' => Yii::app()->user->getState('nickName'),
'email' => Yii::app()->user->getState('email'),
));