Skip to content

Instantly share code, notes, and snippets.

View tankist's full-sized avatar

Victor Gryshko tankist

View GitHub Profile
@tankist
tankist / JS templates benchmark
Created November 13, 2010 15:50
Added John Resig tmpl
<html>
<head>
<title></title>
<style type="text/css">
#panel {margin-top: 5px; margin-bottom: 5px; }
#resulttable{ border: 0 solid #000; background-color: #000;}
#resulttable th{ background-color: #000; color: #fff }
#resulttable td{ background-color: #fff; border: solid 0px #000; }
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<?php
function rand_str($length = 32, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890')
{
// Length of character list
$chars_length = (strlen($chars) - 1);
// Start our string
$string = $chars{rand(0, $chars_length)};
// Generate random string
<?php
interface Drinkable {
//Это можно пить
public function drink();
}
class Liquid_Exception extends Exception {}
//Абстрактный класс Жидкость
abstract class Liquid {
@tankist
tankist / php
Created May 4, 2011 09:13
Collection pagination example
class Model_Mapper_Db_User extends Skaya_Model_Mapper_Db_Abstract {
public function getUsersPaginator($order = null) {
$userTable = self::_getTableByName(self::TABLE_NAME);
$select = $userTable->select();
if ($order) {
$select->order($this->_mapOrderStatement($order));
}
$paginator = Skaya_Paginator::factory($select, 'DbSelect');
$paginator->addFilter(new Zend_Filter_Callback(array(
@tankist
tankist / gitosis-new
Created June 26, 2011 13:42
Gitosis setup new repo
git clone ssh://git@sellcast.com/home/git/repositories/gitosis-admin.git
cd gitosis-admin/
nano gitosis.conf
----
[group modus]
members = vasily@skaya.net victor.gryshko@gmail.com
writable = modus
----
git add .
git commit -am 'Created Modus repo'
@tankist
tankist / doctrine-install
Created January 10, 2012 11:12
Doctrine install via PEAR
pear config-set preferred_state alpha
pear upgrade-all
pear channel-discover pear.doctrine-project.org
pear channel-discover pear.symfony.com
pear install doctrine/DoctrineORM-2.2.0BETA2
pear install doctrine/DoctrineMongoDBODM-1.0.0BETA3
@tankist
tankist / functions.php
Last active December 20, 2015 04:49 — forked from technopagan/default
# How to use the cachebuster function when registering styles in your theme's functions.php
wp_register_style('style',get_bloginfo('stylesheet_directory').autoVer('style.css'),false,NULL,'all');
/**
* Automated cache-buster function via filemtime
**/
function autoVer($url){
$name = explode('.',$url);
$lastext = array_pop($name);
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
multi_accept on;
use epoll;
}
dispatch:beforeDispatchLoop
dispatch:beforeDispatch
dispatch:beforeNotFoundAction
dispatch:beforeExecuteRoute
dispatch:afterInitialize
dispatch:afterExecuteRoute
dispatch:afterDispatch
dispatch:afterDispatchLoop
dispatch:beforeException
@tankist
tankist / ads.php
Last active January 1, 2016 18:19
Proposed migrations fix
<?php
use Phalcon\Db\Column;
use Phalcon\Db\Index;
use Phalcon\Mvc\Model\Migration;
class AdsMigration_1010 extends Migration
{
const TABLE_NAME = 'ads';