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 / 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 / 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 / chown
Created October 8, 2015 00:08
sudo chown -R www-data /путь/к корню/сайта/
sudo chown -R www-data /путь/к корню/сайта/
var i = 0;
(function() {
if (i < 10) {
document.body.innerHTML += i;
i++;
setTimeout(arguments.callee, 1000);
} else {
alert('Закончили');
}
})();
@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 / get-watchers.js
Created October 18, 2015 13:38 — forked from kentcdodds/get-watchers.js
Get Watchers of element and its children
function getWatchers(root) {
root = angular.element(root || document.documentElement);
var watcherCount = 0;
function getElemWatchers(element) {
var isolateWatchers = getWatchersFromScope(element.data().$isolateScope);
var scopeWatchers = getWatchersFromScope(element.data().$scope);
var watchers = scopeWatchers.concat(isolateWatchers);
angular.forEach(element.children(), function (childElement) {
watchers = watchers.concat(getElemWatchers(angular.element(childElement)));
<snippet>
<content><![CDATA[
<!-- begin $1 -->
<div class="$1">
$2
</div>
<!-- end $1 -->
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>di</tabTrigger>
@xto3na
xto3na / Особенности PHP
Last active October 22, 2015 07:13
Особенности PHP
1) Конкатенация:
$a = 10;
$b = 5;
<?php echo $a . $b; ?>
Это выражение выведет: "105".
2) Экранирование спецсимволов в строках:
$brand = "<p style=\"color: red;\"> \"AUDI\" </p>";
@xto3na
xto3na / Choosen filter block
Created October 24, 2015 09:15
Choosen filter block
/************************** CHOOSEN-FILTER-BLOCK *******************************/
var choosen = {};
choosen.listFilters = [];
choosen.update = function () {
this.listFilters = [];
$(".active_filter").each(function (index, elem) {
if ($(elem).attr("data-name") != "min_price"
&& $(elem).attr("data-name") != "max_price") {
@xto3na
xto3na / Возврат функции в JS
Created October 24, 2015 09:24
Возврат функции в JS
var myFunc = function() {
return function(){
console.log("Hi!");
}
};
//Вызов
myFunc()(); //Выведет в консоль "Hi!"