Skip to content

Instantly share code, notes, and snippets.

View dmjcomdem's full-sized avatar
🎯
Focusing

Dimonskiy dmjcomdem

🎯
Focusing
View GitHub Profile
$name-class: ".block1";
#{$name-class} {
font-size: 100px;
&__inner {
font-size: 10px;
&:before { content: ""; }
@at-root #{$name-class}:hover &:before {
color: red;
<div ng-class="condition ? 'class-if-true' : 'class-if-false'">
@dmjcomdem
dmjcomdem / .svg
Last active February 10, 2017 14:34
svg-template.svg
<svg shape-rendering="crispEdges"
width="100%" height="100%" viewBox="0 0 30 30" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
<use xlink:href="#name-icon"></use>
</svg>
<svg class="icon" width="100%" height="100%" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" shape-rendering="crispEdges">
@dmjcomdem
dmjcomdem / ng-class.html
Last active May 16, 2017 11:49
init variables html-local scope
<!-- Add class ng-modal -->
<input type="text" ng-model="styleOne">
<input type="text" ng-model="styleTwo">
<div ng-class="[styleOne, styleTwo]">Look! I'm Words!</div>
<!-- Add the class 'text-success' if the variable 'awesome' is true -->
<input type="checkbox" ng-model="awesome"> Are You Awesome?
<input type="checkbox" ng-model="giant"> Are You a Giant?
<div ng-class="{ 'text-success': awesome, 'text-large': giant }">
@dmjcomdem
dmjcomdem / mixin-extends.less
Created April 26, 2017 05:41
Mixin extends
@mobile: ~'@media (max-width: 400px) ';
@tablet: ~'@media (max-width: 800px) ';
.bp(@rules) {
@media @mobile {
& .mobile { @rules(); }
}
}
.bp2(@point,@rules) {
@dmjcomdem
dmjcomdem / addClass.removeClass.function.js
Created May 15, 2017 07:16
Функция для задания/ удаления класса addClass(elem, class) removeClass(elem, class)
/*
* @param {DOM Element Object} o
* @param {String} c name class
*/
function addClass(o, c) {
var re = new RegExp("(^|\\s)" + c + "(\\s|$)", "g");
if (re.test(o.className)) return
o.className = (o.className + " " + c).replace(/\s+/g, " ").replace(/(^ | $)/g, "");
}
{
"user": "Ученик",
"courses": [
{
"name": "HTML, CSS",
"passed": "true"
},
{
"name": "JavaScript Essential",
"passed": "true"
_startTimer(){
this._stopTimer();
let timeSeconds = 1;
this._timerInterval = this.$interval(() => {
timeSeconds += 1;
this.onlineTimeText = this._formatTime(timeSeconds);
}, 1000);
this.onlineTimeText = this._formatTime(timeSeconds)
}
_stopTimer(){
@dmjcomdem
dmjcomdem / hasOwnProperty.js
Created June 19, 2017 09:34
принадлежит ли объекту данное свойство
if (speciality.id in DescriptionSpeciality)
return DescriptionSpeciality[speciality.id];
@dmjcomdem
dmjcomdem / findMaxRepeatValueArray.js
Last active January 9, 2018 21:50
найти максимальное число в массиве и его количество повторений
let a = [1,2,3,4,5,6,3,4,6,6,3,7,8,8,8,4,5,7,4,6];
let object = a.reduce( (current, item) => {
current[item] = (current[item] || 0) + 1;
return current;
}, {})
let arrayValue = Object.keys(object).reduce( (current, item) => {
current.push( object[item] );
return current