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 / Добавление - удаление классов с помощью JavaScript свойства classList
Created November 27, 2015 21:23
Добавление - удаление классов с помощью JavaScript свойства classList
// добавление элементу класс "foo"
el.classList.add("foo");
// удаление класса "bar"
el.classList.remove("bar");
// переключение класса "foo"
el.classList.toggle("foo");
// возвращает "true" если у класса есть класс "foo", в противном случае "false"
@xto3na
xto3na / JavaScript homework: area and volume of cylinder
Last active November 28, 2015 14:30
JavaScript homework: area and volume of cylinder
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style>
input {
width: 300px;
height: 30px;
font-size: 16px;
}
@xto3na
xto3na / Get Width
Last active November 25, 2015 10:11
Get Width
//JavaScript
var widthOfElement = document.querySelector("#element-id").offsetWidth;
//jQuery
var widthOfElement = $("#element-id").outerWidth();
@xto3na
xto3na / Get Parameter From URL
Created November 23, 2015 10:20
Get Parameter From URL
var getProductId = function () {
var searchElems = {};
if(location.search) {
var pair = (location.search.substr(1)).split('&');
for (var i = pair.length - 1; i >= 0; i--) {
var param = pair[i].split('=');
searchElems[param[0]] = param[1];
};
return searchElems.product_id; //Получаем нужный параметр через точку
}
@xto3na
xto3na / alignmentAllHeights.js
Last active July 15, 2019 06:32
Выравнивание всех блоков по размеру
(function($){
function equalizeHeights(selector) {
var heights = new Array();
// Loop to get all element heights
$(selector).each(function() {
// Need to let sizes be whatever they want so no overflow on resize
$(this).css('height', 'auto');
@xto3na
xto3na / :not() in css
Created November 14, 2015 21:37
:not() in css
.test:not(.test-1):not(.test-2):not(.test-3) {
color: red;
}
@xto3na
xto3na / Git. Создание, удаление удаленной и локальной веток
Created November 14, 2015 14:31
Git. Создание, удаление удаленной и локальной веток
Надо добавить удаленную ветку, чтобы она синхронизировалась через pull/push.
Сначала надо создать удаленную ветку:
git push origin origin:refs/heads/new_branch_name
Стянуть ее
git pull origin
Посмотреть появилась ли в списке удаленных веток:
git branch -r
@xto3na
xto3na / UTF-8 SYMBOLS
Created November 9, 2015 09:06
UTF-8 SYMBOLS
1) ⌃
2) ⌄
3) ︽
4) ︾
5) ︿
6) ﹀
7) 》
8) 《
9) ⬂ ⬃ ⬄ ⬅ ⬆ ⬇ ⬈ ⬉ ⬊ ⬋ ⬌ ⬍ ⬎ ⬏ ⬐ ⬑
10) ❬ ❭ ❮ ❯ ❰ ❱
@xto3na
xto3na / Angular Model
Created November 8, 2015 22:05
Angular Model
var todoModel = (function () {
var _data = [];
function _addItem(name, duedate, description, completed) {
_data.push({
id: getCurrentId(),
name: name,
duedate: duedate,
description: description,
@xto3na
xto3na / calc() in CSS3
Created November 8, 2015 16:42
calc() in CSS3
.element {
width: calc( 100% - 50px );
}