Skip to content

Instantly share code, notes, and snippets.

@iksecreeet
iksecreeet / index.js
Created March 31, 2017 21:52 — forked from OlegShchavelev/index.js
Стоимость доставки отдельной строкой в Minishop2 (после </body>)
<script>
miniShop2.Order.deliveryCost = '#ms2_delivery_cost';
miniShop2.Callbacks.Order.getcost.response.success = function(response) {
var rdc = response.data['delivery_cost'];
if(rdc) $(miniShop2.Order.deliveryCost, miniShop2.Order.order).text(miniShop2.Utils.formatPrice(rdc));
else $(miniShop2.Order.deliveryCost, miniShop2.Order.order).text('0');
}
@iksecreeet
iksecreeet / msOrder
Created April 19, 2017 15:20 — forked from grachov/msOrder
Простой способ для пересчета стоимости заказа после его изменения
<?php
class msOrder extends xPDOSimpleObject
{
public function updateProducts()
{
$originalContext = $this->xpdo->context->get('key');
$this->xpdo->switchContext($this->get('context'));
$originalMiniShop = isset($this->xpdo->services['minishop2']) ? $this->xpdo->services['minishop2'] : null;
$cart = array();
foreach ($this->getMany('Products') as $product) {
@iksecreeet
iksecreeet / .htaccess
Created August 1, 2017 12:22 — forked from splittingred/.htaccess
Example of how to use new REST server class in MODX 2.3+
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*)$ rest/index.php?_rest=$1 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ rest/index.php [QSA,NC,L]
</IfModule>
@iksecreeet
iksecreeet / LICENCE SUBLIME TEXT
Created February 24, 2018 12:34
Sublime Text 3 Serial key build is 3143
## Sublime Text 3 Serial key build is 3103
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
B085E65E 2F5F5360 8489D422 FB8FC1AA
@iksecreeet
iksecreeet / Instructions.sh
Created September 28, 2018 15:57 — forked from GhazanfarMir/Instructions.sh
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa
@iksecreeet
iksecreeet / php7_2_upgrade.sh
Created September 28, 2018 16:02 — forked from fazni/php7_2_upgrade.sh
Installing PHP 7.2 Ubuntu 14.04, 16.04, 17.04, & 17.10
#!/bin/sh
# Installing PHP 7.2
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.2-cli
sudo apt-get install php7.2-mysql php7.2-curl php7.2-json php7.2-cgi php7.2-xsl
# For developer drupal 8 apply patch https://www.drupal.org/files/issues/php_7_2_fatal_error-2894884-3.patch
@iksecreeet
iksecreeet / gist:dc7856a1ed978595eb5c9ce315ccd0b8
Created September 29, 2018 07:20 — forked from splittingred/gist:4689218
Example of modRest, a REST Client, in MODX 2.3.
$config = array(
'baseUrl' => rtrim('http://mywebsite.com/rest/api/','/'),
'format' => 'json', // json or xml, the format to request
'suppressSuffix' => false, // if false, will append .json or .xml to the URI requested
'username' => 'myuser', // if set, will use cURL auth to authenticate user
'password' => 'mypass',
'curlOptions' => array(
'timeout' => 30, // cURL timeout
'otherCurlOption' => 1,
@iksecreeet
iksecreeet / js-task-1.md
Created February 23, 2019 20:22 — forked from codedokode/js-task-1.md
Задания на яваскрипт (простые)
@iksecreeet
iksecreeet / firebase_snapshot_parent.js
Created September 30, 2019 12:07 — forked from anantn/firebase_snapshot_parent.js
Firebase: Get the parent of a snapshot.
function getParent(snapshot) {
// You can get the reference (A Firebase object) from a snapshot
// using .ref().
var ref = snapshot.ref();
// Now simply find the parent and return the name.
return ref.parent().name();
}
var testRef = new Firebase("https://example.firebaseIO-demo.com/foo/bar");
testRef.once("value", function(snapshot) {
@iksecreeet
iksecreeet / gist:3969c8a0d2539fc56a5412b475c5a4fc
Created October 7, 2019 00:00 — forked from realmyst/gist:1262561
Склонение числительных в 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, ['найдена', 'найдено', 'найдены']);