Skip to content

Instantly share code, notes, and snippets.

@lineharo
lineharo / gist:be84e6a9309c035ec79c4219adc36966
Created April 25, 2020 18:49
Install VestaCP(nginx+apache, vsftpd, exim+devocot, DNS named, MySQL) + PHP-7.4 on Ubuntu 18.04 LTS
sudo apt-get update
sudo apt-get install -y vim git curl wget unzip zip gcc build-essential make
sudo apt-get install software-properties-common
curl -O http://vestacp.com/pub/vst-install.sh
bash vst-install.sh --nginx yes --apache yes --phpfpm no --named yes --remi yes --vsftpd yes --proftpd no --iptables yes --fail2ban yes --quota no --exim yes --dovecot yes --spamassassin no --clamav no --softaculous no --mysql yes --postgresql no
@lineharo
lineharo / popup.js
Last active July 28, 2019 16:36
Popup window with HTML+CSS+JS (pug, stylus, jquery)
$('button[data-popup]').click(function(){
$('.popup[data-popup="' + $(this).data('popup') + '"]').fadeIn('fast');
});
$('.popup .close').click(function() {
$(this).parent().parent().fadeOut('fast');
});
$( '.popup' ).mousedown(function(e) {
if (!$(e.target).closest('.window').length ) {
<style>
body {
margin: 0;
padding: 25px;
font-family: sans-serif;
}
/* Option */
.option {
@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();
@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 / 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 / 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 / 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 / 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 / css_features.css
Created February 4, 2017 16:56
Фишки Css
.yourclass div {
all: unset; /* сделать все свойства по-умолчанию */
}