Skip to content

Instantly share code, notes, and snippets.

Andrey andronex

View GitHub Profile
View FormItCSRF.snippet.php
<?php
/**
* A custom FormIt hook for CSRF Protection
*
* Usage:
* Append this Plugin as PreHook and Hook
*
* [[!FormIt?
* &preHooks=`FormItCSRF`
* &hooks=`spam,FormItCSRF,email`
@m-engel
m-engel / MODX FilesTree Drag onlyfiles.php
Last active Aug 5, 2018
MODX FilesTree Drag onlyfiles
View MODX FilesTree Drag onlyfiles.php
// 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);
@kabel
kabel / ocp.php
Last active Sep 20, 2016 — forked from ck-on/ocp.php
View 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)
@realmyst
realmyst / gist:1262561
Created Oct 4, 2011
Склонение числительных в javascript
View gist:1262561
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, ['найдена', 'найдено', 'найдены']);
You can’t perform that action at this time.