Skip to content

Instantly share code, notes, and snippets.

View Fi1osof's full-sized avatar

Nikolay Lanets Fi1osof

View GitHub Profile
@Fi1osof
Fi1osof / machine.js
Last active June 10, 2022 08:12
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@Fi1osof
Fi1osof / react
Last active April 17, 2018 16:56 — forked from koras/react
react
// https://maxfarseer.gitbooks.io/react-course-ru/content/zhiznennii_tsikl_komponenta.html
// https://maxfarseer.gitbooks.io/react-course-ru/content/prodvinutoe_ispolzovanie.html
// https://reactjs.org/docs/faq-ajax.html
import React, { Component } from 'react';
import { Link } from "react-router-dom";
import { promisifyAll } from 'bluebird'
//import ReactDOM from 'react-dom';
import { getWeb3Async } from '../util/web3'
@Fi1osof
Fi1osof / wp_import.php
Last active February 10, 2023 18:51 — forked from zorgsoft/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'];
<?php
class modSiteWebBreadcrumbsProcessor extends modProcessor{
public function initialize(){
$this->setDefaultProperties(array(
'startId' => 0,
'excludeDocs' => array(),
'showHidden' => true,
'showUnpub' => false,
<?php
$q = $modx->newQuery('modResource');
$q->innerJoin('ShopmodxProduct', 'Product');
$q->leftJoin('modTemplateVarResource', 'tv', 'tv.contentid=modResource.id and tv.tmplvarid=29');
$q->where(array(
"tv.id" => null,
));
print $modx->getCount('modResource', $q);
@Fi1osof
Fi1osof / gist:6907324
Created October 9, 2013 19:58
Создаем таблицы и основные записи для пакета Billing
<?php
$manager = $modx->getManager();
// Создаем таблицы
$objects = array(
'Order',
'OrderProduct',
'OrderStatus',
@Fi1osof
Fi1osof / gist:6023918
Last active December 19, 2015 21:59
Дефолтовый контроллер
<?php
$properties = $modx->resource->getOne('Template')->getProperties();
if(!empty($properties['tpl'])){
$tpl = $properties['tpl'];
}
else{
$tpl = 'index.tpl';
}
<?php
/**
* Smarty plugin
*
* @package Smarty
* @subpackage PluginsFunction
*/
function smarty_function_processor($params, & $smarty)
@Fi1osof
Fi1osof / gist:5070120
Created March 2, 2013 08:00
ShopmodxObjectGetListProcessor
<?php
abstract class ShopmodxObjectGetListProcessor extends modObjectGetListProcessor{
function prepareQueryBeforeCount(xPDOQuery $c) {
$this->addDerivativeCriteria($c);
return parent::prepareQueryBeforeCount($c);
}
protected function addDerivativeCriteria(xPDOQuery $c){
$this->modx->addDerivativeCriteria($this->classKey, $c);
@Fi1osof
Fi1osof / gist:5062419
Created March 1, 2013 04:11
OnWebPageComplete stats plugin
<?php
$memory = round(memory_get_usage()/1024/1024, 4).' Mb';
print "<div>Memory: {$memory}</div>";
$totalTime= ($modx->getMicroTime() - $modx->startTime);
$queryTime= $modx->queryTime;
$queryTime= sprintf("%2.4f s", $queryTime);
$queries= isset ($modx->executedQueries) ? $modx->executedQueries : 0;
$totalTime= sprintf("%2.4f s", $totalTime);