Skip to content

Instantly share code, notes, and snippets.

View j-tap's full-sized avatar
🍀
Development

Igor j-tap

🍀
Development
View GitHub Profile
@j-tap
j-tap / js - Functions
Last active September 4, 2019 17:03
user functions
generateToken(length) {
let result = ''
const chars = [
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz',
'0123456789',
]
for (let i = 0; i < length; i += 1) {
const numSet = Math.floor(Math.random() * chars.length)
const numChar = Math.floor(Math.random() * chars[numSet].length)
@j-tap
j-tap / bitrix - Deferred functions
Created May 29, 2017 12:49
Bitrix ShowProperty() Deferred functions
$APPLICATION->ShowProperty('workTitle', ''); // print
/* ... */
$APPLICATION->SetPageProperty('workTitle', $arSection["NAME"]); // set for print
@j-tap
j-tap / html - Meta
Created May 19, 2017 15:11
Meta info in head
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="SITENAME">
<meta name="keywords" content="SITENAME, TAGS">
<meta name="description" content="DESCRIPTION">
<link rel="image_src" href="images/image-site.jpg">
<meta name="author" content="SITENAME">
@j-tap
j-tap / CSS - img cover
Created May 17, 2017 10:50
<img> absolute cover
{
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%,-50%);
-moz-transform: translate(-50%,-50%);
-ms-transform: translate(-50%,-50%);
transform: translate(-50%,-50%);
min-width: 100%;
min-height: 100%;
@j-tap
j-tap / CSS - Columns break
Created May 4, 2017 13:13
not gap <li>..</li> elem
.modal-nav-list {
margin: 0;
padding: 60px 0 0;
list-style: none;
-webkit-columns: 4;
-moz-columns: 4;
columns: 4;
}
.modal-nav-list > li {
margin: 0 0 10px;
@j-tap
j-tap / JS - get Get params
Created April 28, 2017 15:52
get Get params with url
var getUrlParameter = function getUrlParameter (sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
@j-tap
j-tap / Share social
Created April 28, 2017 12:47
Custom share social
oShare = {
init: function () {
$('.js-soc-item').click(function () {
var sType = $(this).data('type');
switch (sType) {
case 'vk':
oShare.vk();
break
case 'fb':
oShare.fb();
@j-tap
j-tap / ajax
Created April 27, 2017 08:44
ajax with file an other fields
var eForm = $('form');
var formData = new FormData(eForm[0]);
$.ajax({
url: eForm.attr('action'),
type: 'POST',
data: formData,
cache: false,
async: false,
contentType: false,
processData: false,
@j-tap
j-tap / select user fields
Last active May 17, 2017 10:52
Bitrix CIBlockSection::GetList UF_*
if (\Bitrix\Main\Loader::includeModule('iblock')) {
$res = CIBlockSection::GetList(
['sort'=>'asc'],
['IBLOCK_ID'=>65, 'ACTIVE'=>'Y', 'DEPTH_LEVEL'=>1],
false,
['*', 'UF_*'],
false
);
while($arSection = $res->GetNext()) {
$aMenuLinks[] = [