Skip to content

Instantly share code, notes, and snippets.

View megamosk's full-sized avatar
🎯
Focusing

megamosk

🎯
Focusing
View GitHub Profile
@glooer
glooer / select_now.php
Created November 22, 2017 21:43
bitrix d7 orm выбор только активных элементов (с учетом даты)
<php
\Bitrix\Iblock\ElementTable::GetList([
'filter' => [
'ACTIVE' => 'Y',
[
"LOGIC" => "OR",
'<ACTIVE_FROM' => new \Bitrix\Main\DB\SqlExpression("NOW()"),
'ACTIVE_FROM' => null,
],
@frosit
frosit / infectedFiles.md
Created May 5, 2016 22:40
Some commands for finding and clearing infected PHP files

Finding infected files with following bash commands

** Command to list all infected files:

  • grep -lr --include=*.php "eval(base64_decode" /path/to/webroot
  • grep -lr --include=*.php "eval" .
  • grep -lr --include=*.php "base64" .

Command to remove malicious code:

  • grep -lr --include=*.php "eval(base64_decode" /path/to/webroot | xargs sed -i.bak 's/<?php eval(base64_decode[^;]*;/<?php\n/g'
@afgomez
afgomez / validate_spanish_id.js
Last active April 22, 2024 07:08
Spanish DNI, CIF, NIE validator
/**
* ValidateSpanishID. Returns the type of document and checks its validity.
*
* Usage:
* ValidateSpanishID( str );
*
* > ValidateSpanishID( '12345678Z' );
* // { type: 'dni', valid: true }
*
* > ValidateSpanishID( 'B83375575' );
@FlameInTheDark
FlameInTheDark / include.discount.city.name.php
Last active April 7, 2024 17:14
Добавление кастомных условий для модуля скидок в 1C Bitrix
<?php
/**
* Добавление кастомного условия для скидок.
* Подключить данный файл в init.php
*
* В данном примере устанавливается проверка города сохраненного в сессии
*/
use Bitrix\Main\Loader;
Loader::includeModule('catalog');
@hlung
hlung / How to connect a PS3 controller.md
Last active March 25, 2024 14:45
How to connect PS3 controller on Mac OSX, PC

How to connect PS3 controller on Mac OSX, PC, etc.

This is how you connect PS3 controller to Mac OSX, PC, etc. when previously connected to a PS3. You will need a Mini USB cable. Overcome your laziness, get up of your chair, and go get one!

A big misconception is that keep holding PS button will reset the controller's pairing. It DOES NOT! From my testings, the controller keeps paring with the last machine it was CONNECTED VIA A USB CABLE.

Here are the steps:

@mrverrall
mrverrall / rhel7-moodle.sh
Last active February 1, 2024 15:00
A script that installs and configures all the core components for moodle on RHEL/Centos 7 leaving you with a running site complete with AV scanning and Memcached
#!/bin/bash
#
# This Bash script installs Moodle (http://moodle.org) and all it's
# requirements into a freshly installed Centos or RHEL 7 operating system.
# It assumes an 'Enforced' SELinux environment and configures the system
# accordingly.
#
# It is designed to be instructional and clear to read to persons unfamiliar
# with Bash and as such does *no* sanity checking before taking actions.
# Becasue of this *great* care should be taken if you feel the urge to run
@Itachi261092
Itachi261092 / README.md
Last active January 15, 2024 08:00
[1C-Bitrix / 1С-Битрикс] AJAX Custom Preloader / Кастомный прелоадер стандартного аякса

Кастомный ajax preloader на 1С-Битрикс.

Сам прелоадер честно стырен отсюда, но его можно заменить любым понравившимся кодом.

Ставится легко и просто. В принципе, все файлы понятно названы и проблем не должно возникнуть.

В футер перед /body ставим вызов включаемой области. Скрипт я обычно копирую вниз включаемой области. Весь код в ней - это хтмл код прелоадера.

CSS можно скопировать в template_styles, а можно подключить отдельно в header.php шаблона сайта.

@andrei99
andrei99 / Debug;
Last active July 26, 2023 14:30
d7 bitrix
\Bitrix\Main\Diag\Debug::writeToFile($signatureValue, '$signatureValue', '__#params_1.log');
//php 8.1
https://www.sng-it.ru/snippet/oshibki-pri-perekhode-sayta-na-bitrikse-na-php-8-1.html
//платежка
https://g-rain-design.ru/blog/posts/payment-handlers-bitrix-d7/
@pda
pda / lircd.conf
Created January 4, 2014 05:35
LIRC config for my Apple Remote (aluminum) on Raspberry Pi / RaspBMC via one of these IR receivers: http://www.ebay.com/itm/121156693642?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649
# Please make this file available to others
# by sending it to <lirc@bartelmus.de>
#
# this config file was automatically generated
# using lirc-0.9.0-pre1(default) on Sat Dec 7 19:14:59 2013
#
# contributed by
#
# brand: lirc-pda.conf
# model no. of remote control:
@VasiliuKr
VasiliuKr / bitrix_smart_filter_ajax.js
Last active October 26, 2022 07:17
catalog.smart.filter - ajax обновление списка без AXAJ_MODE
// В шаблоне bitrix:catalog.smart.filter редактируем script.js - ищим функцию JCSmartFilter.prototype.postHandler и редактируем следующее
//if (modef.style.display === 'none')
//{
// modef.style.display = 'inline-block';
//}
$.get(
result.FILTER_AJAX_URL,
function (data) {