Skip to content

Instantly share code, notes, and snippets.

Avatar

Володя vgrish

View GitHub Profile
View gist:d731c7888e51ace0baa833de0f56e6fe
<?php
/** @var modX $modx */
/** @var array $scriptProperties */
switch ($modx->event->name) {
// расчет стоимости события
case "UserEventsOnBeforeGetOrderCost":
/** @var UserEventsOrderInterface $orderHandler */
$orderHandler = $modx->getOption("order", $scriptProperties);
View gist:5851415d53a1f452107fef931d2b1409
if (!window.FB) window.FB = {
_apiKey: null,
_session: null,
_userStatus: "unknown",
_logging: true,
_inCanvas: window.location.search.indexOf("fb_sig_in_iframe=1") > -1 || window.location.search.indexOf("session=") > -1 || window.location.search.indexOf("signed_request=") > -1 || window.name.indexOf("iframe_canvas") > -1 || window.name.indexOf("app_runner") > -1,
_https: window.name.indexOf("_fb_https") > -1,
_domain: {
api: "https://api.facebook.com/",
api_read: "https://api-read.facebook.com/",
View carthandler.class.php
<?php
public function change($key, $count, $options, $comment)
{
if (array_key_exists($key, $this->cart)) {
if (isset($count) && !is_null($count) && $count <= 0)
return $this->remove($key);
else if(isset($count) && !is_null($count) && $count > 0)
{
if ($count > $this->config['max_count']) {
@vgrish
vgrish / index.html
Created Mar 29, 2016 — forked from anonymous/index.html
JS Bin uikit slideshow + counts // source http://jsbin.com/pewuwi
View index.html
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="uikit slideshow + counts">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.25.0/js/uikit.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.25.0/js/components/slideshow.js"></script>
@vgrish
vgrish / common.js
Last active Mar 11, 2016 — forked from Ibochkarev/common.js
scrollCurrentLink
View common.js
$(document).ready(function () {
$(document).on("scroll", onScroll);
//smoothscroll
$('a[href^="#"][data-anchor="1"]').on('click', function (e) {
e.preventDefault();
$(document).off("scroll");
$('a').each(function () {
$(this).removeClass('active');
@vgrish
vgrish / gist:190d3313253a7af6d63e
Created Feb 27, 2016 — forked from francoishill/gist:6483997
Media queries for mobile devices - Requires at least requires the meta viewport tag with content 'width=device-width'
View gist:190d3313253a7af6d63e
/*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 Nov 2, 2015 — forked from cmsx/VideoThumb.php
Класс для получения превью и информации о ролике RuTube, Vimeo, Youtube по ссылке.
View VideoThumb.php
<?php
/**
* Использование:
* $v = new VideoThumb($link);
* $v->getVideo(); //Ссылка на видео
* $v->getTitle(); //Название ролика
* $v->fetchImage($path) //Скачать самое большое превью ролика
*
* Прогнать тест:
@vgrish
vgrish / miniShop2Tagger.php
Created Oct 6, 2015 — forked from faitno/miniShop2Tagger.php
Plugin for MODx that create port for miniShop2 + Tagger
View miniShop2Tagger.php
<?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 = [];
View wp_import.php
<?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 Sep 7, 2015 — forked from christianseel/introRTE
RTE for introtext #modx
View introRTE
<?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>');