Skip to content

Instantly share code, notes, and snippets.

View andronex's full-sized avatar

Andrey andronex

View GitHub Profile
@realmyst
realmyst / gist:1262561
Created October 4, 2011 19:34
Склонение числительных в javascript
function declOfNum(number, titles) {
cases = [2, 0, 1, 1, 1, 2];
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
}
use:
declOfNum(count, ['найдена', 'найдено', 'найдены']);
@kabel
kabel / ocp.php
Last active September 20, 2016 14:31 — forked from ck-on/ocp.php
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok, n1xim, pennedav, kabel)
Version: 0.2.0
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.2.0 0000-00-00 Updated page layout/styles and restructure code to be more MVC-like (kabel)
implemented HTTP Basic authentication (pennedav)
@m-engel
m-engel / MODX FilesTree Drag onlyfiles.php
Last active August 5, 2018 20:51
MODX FilesTree Drag onlyfiles
// Event: OnManagerPageBeforeRender
$script = "<script>
DirectoryTreeHandleDrop = MODx.tree.Directory.prototype._handleDrop;
Ext.override(MODx.tree.Directory, {
_handleDrop:function(e){
var dropNode = e.dropNode;
var targetParent = e.target;
if(dropNode.hasChildNodes()) return false;
return DirectoryTreeHandleDrop(e);
<?php
/**
* A custom FormIt hook for CSRF Protection
*
* Usage:
* Append this Plugin as PreHook and Hook
*
* [[!FormIt?
* &preHooks=`FormItCSRF`
* &hooks=`spam,FormItCSRF,email`