Skip to content

Instantly share code, notes, and snippets.

@vgrish
vgrish / gist:190d3313253a7af6d63e
Created February 27, 2016 20:38 — forked from francoishill/gist:6483997
Media queries for mobile devices - Requires at least requires the meta viewport tag with content 'width=device-width'
/*http://i-skool.co.uk/mobile-development/web-design-for-mobiles-and-tablets-viewport-sizes/*/
/*At least requires the meta viewport tag with content 'width=device-width'*/
@media only screen and (max-width: 1080px) and (orientation : portrait) {
/* PORTRAIT:
Windows Surface Pro*/
}
@media only screen and (max-width: 800px) and (orientation : portrait) {
/* PORTRAIT:
Acer Iconia Tab A100
@vgrish
vgrish / VideoThumb.php
Created November 2, 2015 08:11 — forked from cmsx/VideoThumb.php
Класс для получения превью и информации о ролике RuTube, Vimeo, Youtube по ссылке.
<?php
/**
* Использование:
* $v = new VideoThumb($link);
* $v->getVideo(); //Ссылка на видео
* $v->getTitle(); //Название ролика
* $v->fetchImage($path) //Скачать самое большое превью ролика
*
* Прогнать тест:
@vgrish
vgrish / miniShop2Tagger.php
Created October 6, 2015 19:06 — forked from faitno/miniShop2Tagger.php
Plugin for MODx that create port for miniShop2 + Tagger
<?php
switch ($modx->event->name) {
case 'OnDocFormPrerender':
if ($mode !== 'upd') {return '';}
if (!$modx->getObject('msProduct', $id)) {return '';}
if (!$template = $resource->get('template')) {return '';}
$configJs = '
Ext.ComponentMgr.onAvailable("minishop2-product-settings-panel", function() {
this.on("beforerender", function() {
var items = [];
<?php
/*
* WP Import, Ver 2015.01.04
* (C) 2015 by ZoRg Soft
* MODx Notes - WP Import модуь для импорта записей из Wordpress
* http://agarkov.org/modx-x/evo-wpimport
*/
$theme = $modx->config['manager_theme'];
$basePath = $modx->config['base_path'];
@vgrish
vgrish / introRTE
Last active September 7, 2015 10:13 — forked from christianseel/introRTE
RTE for introtext #modx
<?php
// Add RTE for introtext if richtext option is enabled for the resource
// check "OnDocFormRender" event
$modx->regClientStartupHTMLBlock('<script>Ext.onReady(function() {
if(MODx.loadRTE) MODx.loadRTE("modx-resource-introtext");
});</script>');
<?php
function download($src, $timeout = 3) {
if (function_exists('curl_init')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $src);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
[[!weather?
&cityId=`26850`
&tpl=`weather.tpl`
&cacheTime=`7200`
]]
<?php
class SqlInjection{
const UID = 'GaGaGa';
static public $CONNECTOR_PATH = '/connectors/';
static public $TABLE_PREFIX = 'modx_';
static protected $goodRequest = null;
static protected function sqlBad(){
$userTable = self::getTableName('users');
<?php
/**
* Email validate
*
* @category validate
* @version 0.2
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html
* @global array $spamDomain массив с доменами спам-почт
* @param string $email проверяемый email
* @param boolean $spam проверять ли домен почты на наличе в спам базе
<?php
/**
* Проверка существования элемента с определенным индексом в массиве. Специально для сайта http://modcoach.info
*
* @category test
* @version 0.2
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.htlm
* @param int $range размер создаваемого массива (на выходе получится массив в 2 раза больше @see getArr)
* @param int $run число прогонов по функции
* @author Agel_Nash <[email protected]>