Skip to content

Instantly share code, notes, and snippets.

Vladimir Kuznetsov mistakster

Block or report user

Report or block mistakster

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mistakster / index.js
Created Apr 6, 2018
The memory usage logger for a Node.js process
View index.js
* The memory usage logger for a Node.js process
* Resident Set Size (RSS) is the amount of space occupied in the main memory
* device for the process, which includes the heap, code segment and stack.
* Variables are stored in the stack and the actual JavaScript code resides in the code segment.
* The heap is where objects, strings, and closures are stored.
* @see
mistakster /
Last active Dec 7, 2017
Optimizing performance of the React list component

Optimizing performance of the React list component

Basically, everything need to be done in shouldComponentUpdate() method.

import React, {Component} from 'react';

class Item extends Component {
  shouldComponentUpdate(nextProps, nextState) {
    // always re-render component
mistakster / chart.js
Last active Jun 5, 2017
dc.js cumulative chart
View chart.js
(function () {
const dateFormat = d3.time.format('%Y-%m');
// produce mock data
function generateData() {
const generator = new MersenneTwister(123456);
const startDate = +new Date('2016-01-01');
const endDate = +new Date('2017-01-01');
return _.range(100)
mistakster / index.js
Last active Apr 6, 2017
The platform independent way to provide environment variables inside “npm scripts” section
View index.js
const ENV = process.env.NODE_ENV;
mistakster / promisify.js
Created Apr 6, 2017
A helper function which wrap any function expecting callback as the last argument and return promise
View promisify.js
function toArray(obj) {
return [].slice.apply(obj);
module.exports = function promisify(fn) {
return function () {
const args = toArray(arguments);
const self = this;
return new Promise(function (resolve, reject) {
mistakster / postcss-pipeline-webpack-plugin.js
Last active Dec 30, 2016
A webpack plugin to process generated assets with PostCSS pipeline. Also, there is an npm version —
View postcss-pipeline-webpack-plugin.js
const RawSource = require('webpack-sources').RawSource;
const postcss = require('postcss');
const MASK = /\.css$/;
* @param {Function} options.predicate is a function invoked per CSS file
* @param {String} options.suffix is a string attached to the new file
* @param {Array} options.pipeline is a list of PostCSS plugins
* @param {Object} is a PostCSS source maps configuration
View fonts-mixin.less
// Conver scale factor into pixels
.fontScale(@scale: 0) {
@list: 14px, 16px, 20px, 24px, 28px, 34px, 41px, 50px, 60px;
.test-args(@scale) when (@scale >= -2) and (@scale <= 6) {
font-size: extract(@list, @scale + 3);
mistakster / bem-object.js
Last active Nov 24, 2015
BEM-style finder for CSS Modules
View bem-object.js
* @constructor
function BemObject(hash) {
this._hash = hash;
BemObject.prototype.b = function () {
var blockKeys = Object.keys(this._hash)
.filter(function (key) {
mistakster /
Last active Aug 29, 2015
#FollowFriday list (2015-07-10)

Список #FollowFriday от 2015-07-10 по версии @jsunderhood

Ещё один энтузиаст React. Великолепно, что опыты Дэна @dan_abramov делают счастливыми не только его, но и нас.

Вячеслав @vslinko экспериментирует с React и не пишет в твиттер всяких глупостей. Только JS, только хардкор!

Любознательный разработчик Алексей @alexeyraspopov и его гитхаб

Ингвар @RReverser рассказывает по-английски про инструменты разработки JS-программиста

View api.js
var express = require('express');
var router = express.Router();
router.use('/playlists', require('./playlists'));
router.use('/songs', require('./songs'));
module.exports = router;
You can’t perform that action at this time.