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 / Плавный скролл к якорю
Last active November 8, 2015 16:51
Плавный скролл к якорю
<script>
$(document).ready(function () {
/* Плавная прокрутка */
$("#scroll-reviews").click(function () {
var elementClick = $(this).attr("href");
var destination = $(elementClick).offset().top;
$("html:not(:animated),body:not(:animated)").animate({scrollTop: destination}, 1500);
return false;
});
/* Плавная прокрутка END */
@xto3na
xto3na / ST3 - Plugins
Last active November 23, 2015 18:53
ST3 - Plugins
1) Emmet
2) Emmet LiveStyle
3) SideBar Enhancement
4) Themr
5) Schemr
6) AdvancedNewFile
7) AutoFileName
8) AngularJS
9) EncodingHelper
10) BracketHighlighter
@xto3na
xto3na / Toggle Open Block JS
Created October 27, 2015 10:00
Toggle Open Block JS
var man = 0;
$(".manufacturers-filter-block .checkbox").each(function (index, elem) {
man++;
});
if (man <= 8) {
$(".pokaz").remove();
};
$(".pokaz>p").on("click", function (mo) {
console.log("click");
$(".manufacturers-filter-block").toggleClass("open");
@xto3na
xto3na / Random JS
Created October 24, 2015 20:23
Random JS
var getRandom = function (min, max) {
return Math.random() * (max - min) + min;
};
@xto3na
xto3na / Возврат функции в JS
Created October 24, 2015 09:24
Возврат функции в JS
var myFunc = function() {
return function(){
console.log("Hi!");
}
};
//Вызов
myFunc()(); //Выведет в консоль "Hi!"
@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 / Особенности 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>";
<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 / 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)));
@xto3na
xto3na / CENTER ELEMENT - position: absolute;.css
Last active December 7, 2015 18:52
CENTER ELEMENT - position: absolute;
.element {
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%);
transform: translateY(-50%);
}