Skip to content

Instantly share code, notes, and snippets.

@d1i1m1o1n
d1i1m1o1n / TimeWeb - SSH RSA Key
Created November 9, 2016 06:53 — forked from zetrider/TimeWeb - SSH RSA Key
Авторизация SSH по RSA ключу - TimeWeb
user - имя пользователя
server.timeweb.ru - сервер
1. На машине ssh-keygen -t rsa
2. Копируем, можно по FTP или одной из команд
2.1. ssh-copy-id -i ~/.ssh/id_rsa user@server.timeweb.ru
2.2. scp ~/.ssh/id_rsa.pub user@server.timeweb.ru:~
3. На сервере
[ -d ~/.ssh ] || (mkdir ~/.ssh; chmod 711 ~/.ssh) # создание директории и изменение прав
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys # добавление открытого ключа
@d1i1m1o1n
d1i1m1o1n / test.js
Created October 13, 2016 16:31
Test
$(document).on('click', '#submit_feedback_form', function(e) {
e.preventDefault();
var empty_input = 0;
$('#feedback_form_content input[type=text], #feedback_form_content textarea').each(function(i, el) {
if($(el).val() == "") {
empty_input = 1;
}
});
@d1i1m1o1n
d1i1m1o1n / text
Created October 6, 2016 12:16
How to disable auto-save in phpstorm
How to disable auto-save:
Go to File > Settings (Ctrl+Alt+S).
Go to Appearance & Behavior > System Settings.
Make sure the two are unchecked:
Save files on frame deactivation
Save files automatically if application is idle for x sec.
Go to Editor > General > Editor Tabs
Put a checkmark on "Mark modified files with asterisk"
(Optional but recommended) Under "Tab Closing Policy", select "Close non-modified files first". You may also want to increase the number of allowed tabs.
Click Apply > OK.
@d1i1m1o1n
d1i1m1o1n / linux.txt
Last active August 2, 2016 13:18
Linux file and directories set privileges and owner and tar gz
To recursively give directories read&execute privileges:
find /path/to/base/dir -type d -exec chmod 755 {} +
To recursively give files read privileges:
find /path/to/base/dir -type f -exec chmod 644 {} +
Changing owner of a directory recursively:
chown -R user:group direcory_to_be_changed
How to find all Zero bytes files in directory including subdirectories:
@d1i1m1o1n
d1i1m1o1n / index.html
Created July 25, 2016 07:44
Transparent 1px image Однопиксельная прозрачная картинка
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7">
@d1i1m1o1n
d1i1m1o1n / template.php
Created July 5, 2016 09:24
Bitrix simple template for "components\bitrix\system.pagenavigation\arrows\template.php" клевый дизайн с Flat Ui http://designmodo.github.io/Flat-UI/
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
//Установка по умолчанию количество отображаемых страниц в пагинации
$DEFAULT_COUNT_PAGE = 10;
//Количество страниц
$PAGE_COUNT = $arResult['NavPageCount'];
//Ссылка
$strNavQueryString = ($arResult["NavQueryString"] != "" ? $arResult["NavQueryString"] . "&amp;" : "");
//Текущая страница
@d1i1m1o1n
d1i1m1o1n / index.php
Created July 5, 2016 09:14
Bitrix. New order d7
<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
global $USER;
use Bitrix\Main,
Bitrix\Main\Loader,
Bitrix\Main\Config\Option,
Bitrix\Sale,
Bitrix\Sale\Order,
Bitrix\Sale\DiscountCouponsManager;
@d1i1m1o1n
d1i1m1o1n / index.html
Created June 10, 2016 06:02
JQuery datepicker vertical weekdays. Календарь с вертикальным выводом дней недели
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test</title>
<link href="jquery-ui.css" rel="stylesheet">
<script type="text/javascript" src="jquery-1.10.2.min.js"></script>
<script src="jquery-ui.js"></script>
</head>
<body>
@d1i1m1o1n
d1i1m1o1n / .parameters.php
Created May 30, 2016 11:47
Bitrix custom param in "bitrix:main.include" datepicker. Битрикс, параметр у компонента "bitrix:main.include" в виде календаря с возможностью выбора даты
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();
$arTemplateParameters = array(
'COUNTDOWN_DATE' => array(
'NAME' => "Дата окончания",
'TYPE' => 'CUSTOM',
// свой подключаемый скрипт
'JS_FILE' => $templateFolder.'/settings.js',
// функция из подключенного скрипта JS_FILE, вызывается при отрисовке окна настроек
@d1i1m1o1n
d1i1m1o1n / index.html
Last active May 26, 2016 12:06
Raiting stars. Отображение рейтинга в виде звездочек
<div class="wrap_stars">
<div class="stars" num="1"></div>
<div class="stars" num="2"></div>
<div class="stars" num="3"></div>
<div class="stars" num="4"></div>
<div class="stars" num="5"></div>
<input type="hidden" name="clean_order">
<div class="wrap_stars__label"></div>
</div>