Skip to content

Instantly share code, notes, and snippets.

@konclave
konclave / tilda-delivery-control.js
Created August 8, 2022 14:26
Script that controls tilda delivery radio buttons states
// Wrap it with <script></script> before pasting to the block
document.addEventListener('DOMContentLoaded', (event) => {
var selfServiceIndex = [3, 4];
var deliveryIndex = [1, 2];
var selfService = document.querySelectorAll(getDeliverySelectors(selfServiceIndex));
var delivery = document.querySelectorAll(getDeliverySelectors(deliveryIndex));
selfService.forEach(function(element) {
@konclave
konclave / meduza-io-remove-banner.js
Last active May 17, 2021 15:27
Userscript that removes "Foreign Agent" banner from Meduza news articles
// ==UserScript==
// @name Meduza.io foreign agent banner remove
// @name:ru Meduza.io удаление баннера об иностранном агенте
// @namespace https://meduza.io/
// @version 0.3
// @description Removes foreign agent banner from Meduza news site
// @description:ru Удаляет баннер об иностранном агенте из новостей Meduza
// @author konclave
// @match https://meduza.io/*
// @grant none
+ deploy/front/drone/dev-build.sh dev
This script will automatically install sentry-cli 1.53.0 for you.
Installation path: /usr/local/bin/sentry-cli
Warning: this script is currently running as root. This is dangerous.
Instead run it as normal user. We will sudo as needed.
############# 18.8%
######################################################################## 100.0%
Done!
[make] Remove previous static files
+ deploy/front/drone/dev-build.sh dev
This script will automatically install sentry-cli 1.54.0 for you.
Installation path: /usr/local/bin/sentry-cli
Warning: this script is currently running as root. This is dangerous.
Instead run it as normal user. We will sudo as needed.
################ 22.4%
######################################################################## 100.0%
Done!
[make] Remove previous static files
@konclave
konclave / tickets.spec.js
Last active March 13, 2020 11:15
Widget action test example
import mockI18n from '../../i18n';
import {TICKETS_MAX_VALUE} from '../../preloadedState';
/* Здесь тестируется вызов addTicket с параметрами, которые приводят к завершению функции на первом же условии:
билетов больше чем можно положить в заказ */
/* смотрим в addTicket и понимаем что там в условии используется TICKETS_MAX_VALUE из preloadedState. Значит мокаем его */
jest.mock('../../preloadedState', () => ({
TICKETS_MAX_VALUE: 4
}));
@konclave
konclave / .bash_profile
Last active October 24, 2019 09:59
Bash command to read markdown files with less in Mac terminal.
# pandoc install require: brew install pandoc
mdless() {
if [ -z "$1" ]
then
echo "Need argument"
else
pandoc -s -f markdown -t man $1 | \
groff -T utf8 -man | \
less
fi
@konclave
konclave / ga_cid.js
Created August 16, 2019 13:15
decorate URL with ga_cid param
const decorateLink = (src) => {
const gacid = getUrlParameter('_ga');
if (isWidgetShowroom() && gacid) {
return `${src}&_ga=${gacid}`;
}
if (window.ga && window.ga.getAll) {
window.ga('require', 'linker');
const tracker = window.ga.getAll()[0];
const googleAnalyticsLinker = window.gaplugins ? (new window.gaplugins.Linker(tracker)) : null;
return googleAnalyticsLinker ? googleAnalyticsLinker.decorate(src) : src;
<script>
document.addEventListener('DOMContentLoaded', function() {
var formAction = 'https://www.moneta.ru/assistant.htm';
var formParams = {
MNT_ID: '85531267',
MNT_TEST_MODE: '0',
PS: '1686945',
ACTIVE_PS: '1686945'
};
var form = document.querySelector('.js-form-proccess');