Skip to content

Instantly share code, notes, and snippets.

View dmitru's full-sized avatar
🎯

Dmitry Borody dmitru

🎯
  • Inkarnate
  • Remote
  • 18:41 (UTC +04:00)
View GitHub Profile
@dmitru
dmitru / deepFlatten.js
Last active April 23, 2018 17:08
Function for deep object flattening (see test cases)
import map from 'lodash/map'
function deepFlattenHelper(obj, acc = {}, path = []) {
if (!obj) {
return acc
}
let result = { ...acc }
if (typeof obj === 'object') {
@dmitru
dmitru / course_project_mocked_data.js
Created December 10, 2017 22:51
Mocked data for course project for React Workshop
const EXAMPLE_TIME_ENTRIES = [
{
id: 1,
date: '2017-11-20',
categoryId: 1,
notes: 'some example notes',
minutesTracked: 180,
},
{
id: 2,
@dmitru
dmitru / spinner-button.jsx
Last active September 14, 2017 15:15
A React wrapper component for Ladda library - buttons with spinners
import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import Ladda from 'ladda';
import cx from 'classnames';
export default class SpinnerButton extends React.Component {
static propTypes = {
loading: PropTypes.bool,
className: PropTypes.string,
import Application from '../application';
import renderScreen from '../utils/render-screen';
import computePercentage from '../utils/compute-percentage';
import timer from './timer-presenter';
import state from '../data/state';
import adapter from '../data/adapter';
import LevelArtistView from '../view/level-artist-view';
'use strict';
(function () {
var pinHandle = document.querySelector('.pin__main');
var formAddress = document.querySelector('#address');
var PIN_HEIGHT = 94;
var PIN_WIDTH = 74;
var tokyoMap = document.querySelector('.tokyo');
var MIN_X = 0;
var MAX_X = 1200;
@dmitru
dmitru / map.js
Created April 27, 2017 19:01
map.js oleg
'use strict';
(function () {
var pins;
var type;
var price;
var roomNumbers;
var guestNumbers;
var featuresSets = [];
var housingType = document.querySelector('#housing_type');
@dmitru
dmitru / feedback.txt
Created April 25, 2017 17:03
Feedback on Keksobooking
js/forms.js:12: var syncValues = function (element, value) { // TODO: make it a normal function instead of "var foo = function" expression
js/forms.js:16: var syncValueWithMin = function (element, value) { // TODO: make it a normal function instead of "var foo = function" expression
js/filter.js:11: var checkboxNames = ['wifi', 'dishwasher', 'parking', 'washer', 'elevator', 'conditioner']; // TODO: Name constants LIKE_THIS
js/filter.js:81: window.filter = function (offerList) { // TODO: move assignment to window outside of the module
js/load.js:8: var onError = function (errorMessage) { // TODO: make it a normal function instead of "var foo = function" expression, name it as an event handler
js/load.js:29: xhr.timeout = 10000; // 10s TODO: Name a constant LIKE_THAT
js/map.js:5: var updatePins = function (offers) { // TODO: make it a normal function instead of "var foo = function" expression
js/map.js:9: var onLoad = function (data) { // TODO: make it a normal function instead of "var foo = func
@dmitru
dmitru / keksobooking-module7-task1.js
Created April 20, 2017 15:48
keksobooking-module7-task1 - filters example
'use strict';
/* global utils */
(function () {
var filteredList = [];
var filterContainer = document.querySelector('.tokyo__filters-container');
var filterHousing = filterContainer.querySelector('#housing_type');
var filterPrice = filterContainer.querySelector('#housing_price');
var filterRoomNumber = filterContainer.querySelector('#housing_room-number');
var filterGuestsNumber = filterContainer.querySelector('#housing_guests-number');
'use strict';
function setupMap() {
var titles = [
'Большая уютная квартира',
'Маленькая неуютная квартира',
'Огромный прекрасный дворец',
'Маленький ужасный дворец',
'Красивый гостевой домик',
@import 'themes.scss';
@mixin themify($themes: $themes) {
@each $theme, $map in $themes {
.theme-#{$theme} & {
$theme-map: () !global;
@each $key, $submap in $map {
$value: map-get(map-get($themes, $theme), '#{$key}');
$theme-map: map-merge($theme-map, ($key: $value)) !global;