Skip to content

Instantly share code, notes, and snippets.

View xboston's full-sized avatar

Nikolay Kirsh xboston

View GitHub Profile
@xboston
xboston / trait-test.php
Created January 24, 2014 12:32
Trait test
<?php
/**
* Class fuck
*/
trait fuck
{
public function test()
{
@xboston
xboston / deploy.rb
Created January 25, 2014 08:16 — forked from jmather/deploy.rb
after "deploy", "deploy:cleanup"
after "deploy:update_code", "composer:install"
before "composer:install", "composer:copy_vendors"
after "composer:install", "phpunit:run_tests"
namespace :composer do
desc "Copy vendors from previous release"
task :copy_vendors, :except => { :no_release => true } do
run "if [ -d #{previous_release}/vendor ]; then cp -a #{previous_release}/vendor #{latest_release}/vendor; fi"
end
>>> 0x7f6a92e01c20 1 zim_Phalcon_Mvc_View_Engine_Volt_Compiler_expression
>>> 0x7f6a92e01bd0 1 zim_Phalcon_Mvc_View_Engine_Volt_Compiler_expression
>>> 0x7f6a92e01b80 1 zim_Phalcon_Mvc_View_Engine_Volt_Compiler_expression
>>> 0x7f6a92e01b30 1 zim_Phalcon_Mvc_View_Engine_Volt_Compiler_expression
>>> 0x7f6a92e01ae0 1 zim_Phalcon_Mvc_View_Engine_Volt_Compiler_expression
>>> 0x7f6a92e01a90 1 zim_Phalcon_Mvc_View_Engine_Volt_Compiler_functionCall
>>> 0x7f6a92e01a40 1 zim_Phalcon_Mvc_View_Engine_Volt_Compiler_expression
>>> 0x7f6a92e019f0 1 zim_Phalcon_Mvc_View_Engine_Volt_Compiler_compileEcho
>>> 0x7f6a92e019a0 1 zim_Phalcon_Mvc_View_Engine_Volt_Compiler__statementList
>>> 0x7f6a92e01950 1 zim_Phalcon_Mvc_View_Engine_Volt_Compiler_compileForeach
@xboston
xboston / Timestampable.php
Created April 8, 2014 09:44
phalcon timestampable trait
<?php
namespace ShareModels\Traits {
use Phalcon\Mvc\Model\Behavior\Timestampable as TimestampableBehavior;
/**
* Class Timestampable
*
* @method addBehavior
@xboston
xboston / wingets.php
Created April 9, 2014 10:15
Phalcon wingets
<?php
/**
Регистрация сервиса представлений
$di['widgetRender'] = function () use ($di) {
$view = new Phalcon\Mvc\View\Simple();
$view->setViewsDir(APPLICATION_ROOT . '/Views/Widgets/');
@xboston
xboston / MenuWinget.php
Created April 9, 2014 11:18
MenuWinget.php
<?php
namespace Widgets {
use Mytutcodim\Mvc\View\Widget;
/**
* Class Menu
*
* @package Widget
@xboston
xboston / gist:10874227
Created April 16, 2014 13:22
href to image
// для ссылок ведущих на изображение выводим превью
$('#chat_body div:last span.message a:regex(data:extension, png|jpg|jpeg|gif)').each(function() {
_img_class = this.href.indexOf('images/smiles')>0 ? '':'images_from_message';
$(this).html($('<img/>').attr('src',this.href).attr('class', _img_class));
_img_class = '';
});
@xboston
xboston / gist:10875065
Created April 16, 2014 13:28
Очеловечивание ссылок на медиа-файлы
// PRIVATE очеловечиваем ссылки на медиа-файлы
this._parseMedia = function(){
var _img_class = '';
// подсвечиваем все ссылки
$message = $('#chat_body div:last .message');
$message.html( ' '+$message.html()+' ' );
$message.html($message.html().replace(/(\s|^)(https?:\/\/\S+)/gi,"$1<a href=\"$2\" target=\"_blank\">$2</a>"));
// определяем расширение куда ведут ссылки в сообщении
@xboston
xboston / mailcatcher.nginx.conf
Created October 16, 2014 06:40
Mailcatcher & Vagrant
# Для проброса интерфейса Mailcatcher из Vagrant к пользователю
#
server {
listen 80;
server_name mailcatcher.loc www.mailcatcher.loc;
location / {
proxy_pass http://127.0.0.1:1080;
}
@xboston
xboston / es-aggs-group-by.json
Created January 20, 2015 11:35
Поиск по elasticsearch с группировкой по полю, одно значение поля - один результат
{
"size": 0,
"query": {
"simple_query_string": {
"query": "найди это",
"fields": [
"title",
"domain",
"description",
"keywords",