Skip to content

Instantly share code, notes, and snippets.

@ig0r74
ig0r74 / backgroungAnimation.css
Last active August 29, 2015 14:17
Анимированный градиентный фон
body {
background: linear-gradient(231deg, #00efb1, #eb70d8);
background-size: 400% 400%;
-webkit-animation: animbgr 30s ease infinite;
-moz-animation: animbgr 30s ease infinite;
-o-animation: animbgr 30s ease infinite;
animation: animbgr 30s ease infinite;
}
@-webkit-keyframes animbgr {
0%{background-position:97% 0%}
@ig0r74
ig0r74 / gradient_text.html
Last active September 17, 2015 04:09
Градиентный текст при помощи SVG
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Градиентный текст</title>
<style>
.page-title__label {
font-weight: 100;
font-size: 52px;
letter-spacing: .05em;
@ig0r74
ig0r74 / embed.html
Created October 15, 2015 09:45
Embed PDF File
<!-- DC PDF Embed Start -->
<iframe src="http://docs.google.com/viewer?url=http://cdn.dcodes.net/sc-samples/sample.pdf&embedded=true" style="width:760px; height:400px;" frameborder="0">
Your browser should support iFrame to view this PDF document</iframe>
<!-- DC PDF Embed End -->
Parameters:
---------------------
url - path to PDF file
embedded (true/false) - embed into page
width - width of pdf frame
@ig0r74
ig0r74 / to-translit.sh
Last active December 18, 2015 06:17
Перекодирует рекурсивно в текущем каталоге имена файлов и каталогов в транслит.
#!/bin/bash
#Пример перехода в папку: cd /home/user/Рабочий\ стол/папка/
#далее: ./to-translit.sh или bash to-translit.sh
# Перекодирует рекурсивно в текущем каталоге имена
# файлов и каталогов в транслит.
SCRIPT=`readlink -e $0`
for NAME in *
do
LAT="$(echo $NAME | sed y/абвгдеёзийклмнопрстуфхцы/abvgdeezijklmnoprstufhcy/)"
@ig0r74
ig0r74 / pdoResources.php
Created March 15, 2016 06:23
Фильтрация в pdoResources
[[!pdoResources?
&parents=`15`
&depth=`0`
&tpl=`tpl_house_page`
&includeTVs=`people, main-pic, 1st-floor-square, 2nd-floor-square, Balkon-square, Common-square, Terassa-square`
&where=`{
"Common-square:<=":"[[!#POST.square]]",
"AND:people:>=":"[[!#POST.people_count]]"
}`
&showLog=`0`
@ig0r74
ig0r74 / news.tpl
Created August 18, 2016 09:36
Предыдущая и следующая новость в Smarty
{$params = [
'currid' => {$modx->resource->id}
]}
{processor action="web/prevnext/getdata" params=$params ns=modxsite assign=result}
{$pn=$result.object}
<div class="row">
<div class="col-md-4 text-center">
@ig0r74
ig0r74 / redirect.php
Created August 26, 2016 11:32
Редирект с index.php на /
<?php
switch($modx->event->name){
case 'OnMODXInit':
if(strpos($_SERVER['REQUEST_URI'], '/index.php') === 0){
$modx->sendRedirect($modx->getOption("base_url", null, '/'), array(
'responseCode' => 'HTTP/1.1 301 Moved Permanently'
));
return;
}
@ig0r74
ig0r74 / convert.php
Created April 27, 2017 14:47
Преобразование из windows-1252 в utf-8
<?php
$text = 'Ìàðèíà';
$text = iconv("utf-8", "windows-1252", $text);
$text = iconv("windows-1251", "utf-8", $text);
echo $text;
LOAD DATA INFILE '/home/k/ko/site.ru/comments.csv'
INTO TABLE modx_formit_forms
FIELDS TERMINATED BY '|' ENCLOSED BY '`'
LINES TERMINATED BY '\n'
(id,form,context_key,`values`,ip,@date,encrypted)
SET expired_date = STR_TO_DATE(@date, '%d.%m.%Y');
@ig0r74
ig0r74 / acetv.plugin.php
Created August 10, 2017 09:19
ACE Editot TV-type. Plugin listen OnDocFormRender event and must be execute after Ace plugin, so set priority something like 10 or higher. TV type must be textarea.
<?php
//Apply ace editor to TV with id 5 and 7
$tvs = array(
array(
'id' => 5,
'height' => '600px',
'mimeType' => 'application/json'
),
array(
'id' => 7,