Skip to content

Instantly share code, notes, and snippets.

View xto3na's full-sized avatar

Sergey Ponomarenko xto3na

  • Dnepropetrovsk, Ukraine
View GitHub Profile
@xto3na
xto3na / Breadcrumb - remove last href...js
Last active December 7, 2015 18:52
Breadcrumb - remove last href...
$(".breadcrumb>li:last>a").removeAttr("href").css("cursor", "default").css("font-weight", "600");
$(".breadcrumb>li:last>a").on("click", function(ev) {
ev.preventDefault();
});
@xto3na
xto3na / Цикличный обратный отсчет на JS
Created October 14, 2015 13:37
Цикличный обратный отсчет на JS
/******************** Обратный отсчет *************************/
var month = new Date().getMonth() + 1;
if (month == 0) {month++;};
console.log(month);
var currentDate = new Date();
var futureDate = new Date(2015, month, 1);
var diff = futureDate.getTime() / 1000 - currentDate.getTime() / 1000;
/*var diff = 3600 * 24 * 20.17535;*/
@xto3na
xto3na / chown
Created October 8, 2015 00:08
sudo chown -R www-data /путь/к корню/сайта/
sudo chown -R www-data /путь/к корню/сайта/
@xto3na
xto3na / ParseHelper.cs
Created September 25, 2015 19:35
ParseHelper
using System.IO;
using System.Net;
namespace SEO_Analyzer.Helpers
{
public class ParseHelper
{
public static string DownloadHtml(string uri)
{
HttpWebRequest request = WebRequest.Create(uri) as HttpWebRequest;
@xto3na
xto3na / Text Overflow
Last active September 25, 2015 17:32
Text Overflow
1) max-width: n px(%); word-wrap:break-word; text-overflow: ellipsis; white-space: none;
2) .hyphens {
-webkit-hyphens: auto;
-moz-hyphens: auto;
-ms-hyphens: auto;
hyphens: auto;
}
3) .word-break {
@xto3na
xto3na / Edit location
Last active October 27, 2015 14:43
Edit location
$('#button-filter').on('click', function(bf) {
var stepCount = 2;
var currentUrl = window.location;
var firstAddr = currentUrl.pathname.toString().match(/^\/[a-z]*\/?/);
window.location = location.protocol + "//" + location.hostname + firstAddr[0] + location.search;
//window.history.go( - stepCount);
bf.stopImmediatePropagation();
});
//OR
@xto3na
xto3na / Tree CHECKED
Created September 21, 2015 07:40
Tree CHECKED
<script type="text/javascript">
$('input[type="checkbox"]').on("click", function() {
var items = $(this).closest("li").find("input");
if ($(this).is(':checked')) {
for(var i = 0; i< items.length; i ++) {
items[i].checked = true;
}
}else {
console.log("false");
for(var i = 0; i< items.length; i ++) {
@xto3na
xto3na / git push to other branch!!!
Created September 17, 2015 11:32
git push to other branch!!!
git push origin HEAD:branch_name
@xto3na
xto3na / gist:d311349c89360b79a2b4
Created September 15, 2015 08:15
PHP - if else in html
<?php if ($product['quantity'] > 0) { ?>
<p class="product-exist">В наличии</p>
<?php } else { ?>
<p class="product-not-exist">Нет в наличии</p>
<?php } ?>
@xto3na
xto3na / JS - constructor
Created September 3, 2015 20:51
JS - constructor
function User(name) {
//Если конструктор вызван без ключевого слова new, this это window
//B таком случае вызывается этот же конструктор, но с ключевым словом new
if(!(this instanceof User)) {
return new User(name);
}
this.name = name;
};