Skip to content

Instantly share code, notes, and snippets.

View ischenkodv's full-sized avatar

Dmitri Ischenko ischenkodv

  • Ukraine, Kryvyi Rih
View GitHub Profile
<?php
namespace My\Application\Container;
use Doctrine\Common\Annotations\AnnotationReader,
Doctrine\MongoDB\Connection,
Doctrine\ODM\MongoDB\Configuration,
Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver,
Doctrine\ODM\MongoDB\DocumentManager;
/**
@ischenkodv
ischenkodv / gist:812481
Created February 5, 2011 14:13
Table View Helper for Zend Framework.
<?php
/**
* Table View Helper
*/
class App_View_Helper_Table extends Zend_View_Helper_Placeholder_Container_Standalone
{
/**
* @var string registry key
*/
@ischenkodv
ischenkodv / gist:745436
Created December 17, 2010 18:27
Checkboxes in Sencha TreeGrid
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.ux.tree.TreeGridNodeUI
* @extends Ext.tree.TreeNodeUI
*/
Function.prototype.inherits = function(fnParent) {
this.prototype.super = fnParent;
for (var s in fnParent.prototype) {
this.prototype[s] = fnParent.prototype[s];
}
return this;
}
parentClass = function (args) {
this._name = '';
function calculate_median($arr) {
$count = count($arr); //total numbers in array
$middleval = floor(($count-1)/2); // find the middle value, or the lowest middle value
if($count % 2) { // odd number, middle is the median
$median = $arr[$middleval];
} else { // even number, calculate avg of 2 medians
$low = $arr[$middleval];
$high = $arr[$middleval+1];
$median = (($low+$high)/2);
}
<?php $this->table()->setCaption('Список записей')
->setAttributes(array('class' => 'mytable', 'id' => 'postsList'))
->setFooter('<a href="/admin/blog/create">Создать новую запись</a>')
->setColumns(array('title' => 'Название','post_author' => 'Автор','edit_options' => ''))
->setCellContent('<a href="/admin/blog/edit?id={id}">Редактировать</a>', 'edit_options')
->setEmptyRowContent('Пока нет ни одной записи')
->setRows($this->posts); ?>
<?= $this->table() ?>
@ischenkodv
ischenkodv / endless.js
Created April 18, 2009 21:35
Script for endless scrolling using jQuery
// script for endless scrolling using jQuery
// demo: http://www.jstoolbox.com/demo/endless/
var engine = {
posts : [],
target : null,
busy : false,
count : 5,
render : function(obj){