Skip to content

Instantly share code, notes, and snippets.

@lineharo
lineharo / header.pug
Created December 26, 2016 19:46
PUG - auto version .css or another files in HTML head
- function pDate() {
- return new Date().getTime();
- }
doctype html
html(lang="ru")
head
meta(charset="utf-8")
title TITLE
@lineharo
lineharo / mail_test.php
Created December 26, 2016 20:05
Tiny mail test for php
<?php
$address="[email protected]";
$subj="Mail Test";
$text=date("D, d.m.y, H:i");
$head="Content-type:text/plain; \n\t charset=windows-1251;";
echo "Sending to $address";
mail($address, $subj, $text, $head);
echo "Ok, it works";
@lineharo
lineharo / css_features.css
Created February 4, 2017 16:56
Фишки Css
.yourclass div {
all: unset; /* сделать все свойства по-умолчанию */
}
@lineharo
lineharo / slider.js
Created March 28, 2017 19:55
Слайдер из фоновых изображений
Full: https://tympanus.net/codrops/2013/04/17/background-slideshow/
$(document).ready(function ()
{
$(function() {
//bgSlides.init();
});
var bgSlides = (function() {
var $topslider = $('.slides');
@lineharo
lineharo / upload.php
Created July 8, 2017 11:11
Upload files PHP
<?php
/*******************************************************
* Only these origins will be allowed to upload images *
******************************************************/
$accepted_origins = array("http://localhost", "http://192.168.1.1", "http://example.com");
/*********************************************
* Change this line to set the upload folder *
*********************************************/
$imageFolder = "images/";
@lineharo
lineharo / ang-img-blog.bat
Last active April 10, 2019 06:26
Обрезка и оптимизация изображений (jpeg) - batch for Windows with ImageMagick & JpegTran
rem Преобразовывает все изображения в 1024*768 и 285х200 + оптимизирует их
rem Нужны программы: ImageMagick (https://www.imagemagick.org/script/download.php) и jpegtran (http://jpegclub.org/jpegtran/)
for %%f in (*.jpg) do (
magick %%f -resize "285x200^" -gravity center -extent 285x200 "%%~nf-thumb.jpg"
jpegtran -copy none -optimize -progressive -outfile "%%~nf-thumb.jpg" "%%~nf-thumb.jpg"
magick %%f -resize "1024x768<" -gravity center -extent 1024x768 "%%~nf-view.jpg"
jpegtran -copy none -optimize -outfile "%%~nf-view.jpg" "%%~nf-view.jpg"
)
@lineharo
lineharo / css-generators.styl
Last active April 14, 2019 15:13 — forked from jeremyben/generators.scss
Css space around element generators (margin, padding) #css #stylus
// Generate class helpers for size properties such as margin, padding
// Usage :
// marginer(0.5, 3, 0.5)
// .mt3 will then add margin-top: 2.5rem; to the element,
// and so on for each side, from 0.5rem to 2,5rem with a 0.5rem step.
paddinger(min, max, step, counter=0)
.pt{counter}
padding-top (min rem)
.pb{counter}
@lineharo
lineharo / bitrix_getpages.php
Last active April 18, 2019 02:16
Get bitrix pages content from sitemap
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
if (!is_array($arResult["arMap"]) || count($arResult["arMap"]) < 1)
return;
$resArr = [];
$tmpArr = [];
foreach($arResult["arMap"] as $index => $arItem){
@lineharo
lineharo / Get bitrix infoblock content
Created April 18, 2019 02:39
bitrix_getinfoblock.php
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
$news = CIBlockElement::GetList(["SORT"=>"ASC"],['IBLOCK_ID'=>13]);
$fp = fopen('dump_news.txt', 'a');
while($ob = $news->GetNextElement())
{
$arFields = $ob->GetFields();
<style>
body {
margin: 0;
padding: 25px;
font-family: sans-serif;
}
/* Option */
.option {