Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Andrei rdbox

🎯
Focusing
Block or report user

Report or block rdbox

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View jquery AddGetCookie
/*Данный код дает возможность добавлять и читать куки*/
function set_cookie(name, value, expires, path, domain, secure) {
var cookie_string = name + "=" + escape(value);
if (typeof expires == 'number' && expires > 0) {
var d = new Date();
var n = new Date(d.setTime(d.getTime() + expires * 1000));
expires = n.toUTCString();
cookie_string += "; expires=" + expires;
}
View jquery AnimateScrollPage
jQuery(document).ready(function($) {
$('a[href^="#"]').click(function() {
var el = $(this).attr('href');
$('body').animate({
scrollTop: $(el).offset().top
}, 2000);
return false;
});
});
View jquery SelectFieldPrice
<script>
var selectVarPrice = {{selectTotalPrice}};
function totalPrice() {
if (selectVarPrice.length >= 13) {selectVarPrice = selectVarPrice.substring(0, 6);}
else if (selectVarPrice.length >= 12) {selectVarPrice = selectVarPrice.substring(0, 5);}
else if (selectVarPrice.length >= 11) {selectVarPrice = selectVarPrice.substring(0, 4);}
else if (selectVarPrice.length >= 10) {selectVarPrice = selectVarPrice.substring(0, 3);}
return [selectVarPrice];
}
View js RandomHash
/*
Example:
hash(5);
"XjJfV"
hash('xxxx-xx-xxxx-2011')
"YDFb-5e-cShX-2011"
hash = (+new Date());
console.log(hash);
View js ExtrackURLSearchQuery
/*
Функция из URL извлекает pathname
после указываем условия при котором идет и поиск совпадения
lastIndexOf() ищет значние в индексе, выводить на экран все после "/""
*/
function () {
var pagePath = location.pathname;
if (pagePath.indexOf("/search/") === 0) {
var searchString = pagePath.substring(pagePath.lastIndexOf("/") + 1);
return searchString;
View css alignment blocks width
html,body, ul, li, div {
margin: 0;
padding: 0;
}
ul {
font-family: Verdana, Geneva, sans-serif;
text-align: justify;
View jquery DownloadURL
<script type="text/javascript" src=" https://code.jquery.com/jquery-2.2.2.min.js"></script>
View create git-file
#Create file with name 'post-receive' in directory hooks
#delete full comment
#!/bin/sh
git --work-tree=/var/www/domain.com --git-dir=/var/repo/site.git checkout -f
@rdbox
rdbox / config.ini
Last active May 31, 2016
fix: power off vmware memory size
View config.ini
# Решаем bug vmware - physical memory
Not enough physical memory is available to power on this virtual machine with its configured settings.
To fix this problem, power off other virtual machines, decrease the memory size of this virtual machine to 1640 MB, increase the amount of physical memory for all virtual machines to 3904 MB, or adjust the additional memory settings to allow more virtual machine memory to be swapped.
# Создать файл config.ini внести следующие строчки кода
vmmon.disableHostParameters = "TRUE"
prefvmx.minVmMemPct = "25"
# И разместить его в папке
@rdbox
rdbox / deploy-config.php
Last active Jun 1, 2016
git: deployment to site
View deploy-config.php
<?php
/**
* Simple PHP Git deploy script
*
* Automatically deploy the code using PHP and Git.
*
* @version 1.3.1
* @link https://github.com/markomarkovic/simple-php-git-deploy/
*/
You can’t perform that action at this time.