Skip to content

Instantly share code, notes, and snippets.

Dmitry Shvalyov dshster

Block or report user

Report or block dshster

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
dshster / after_res_hooks.js
Created Jan 1, 2018 — forked from pasupulaphani/after_res_hooks.js
Mongoose connection best practices
View after_res_hooks.js
var db = mongoose.connect('mongodb://localhost:27017/DB');
// In middleware
app.use(function (req, res, next) {
// action after response
var afterResponse = function() {{req: req}, "End request");
// any other clean ups
dshster / application.js
Created Oct 7, 2017
Yandex Maps random polygones
View application.js
const margin = 200;
const theta = 0.2;
function getRandomCoords({ width, height }) {
return {
top: Math.random() * (width - margin) + margin / 2,
left: Math.random() * (height - margin) + margin / 2,
dshster / InstagramImgDownload.js
Created Jun 12, 2016
Append download link to instagram photos (userscript)
View InstagramImgDownload.js
// ==UserScript==
// @name Instagram image in a new tab
// @namespace
// @version 0.1
// @description append download link to photos
// @author dshster
// @match*
// @grant none
// ==/UserScript==
dshster / application.js
Created Mar 4, 2016
Angular e2e with http mock
View application.js
(function(application, dependencies) {
angular.module(application, dependencies);
})('application', []);
(function(application) {
.controller('SampleController', SampleController);
SampleController.$inject = ['$http'];
dshster / application.js
Created Feb 16, 2016
Angular bootstrap
View application.js
var application = 'application';
angular.module(application, ['ngMockE2E']);
.controller('SampleController', function(SampleServices) {
var Sample = this;
SampleServices.getServerData().then(function(result) {
Sample.serverData = result;
dshster / entry.js
Last active Feb 16, 2016
Webpack PostCSS bootstrap
View entry.js
var css = require('./styles.postcss');


npm install



dshster / application.js
Last active Aug 29, 2015
AngularJS backend-less development
View application.js
'use strict';
var application = 'application';
var dependences = ['ngMockE2E'];
angular.module(application, dependences)
.config(['$compileProvider', function($compileProvider) {

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;

video /deep/ input[type=range] {
dshster / index.html
Created Feb 11, 2015
Drag and drop, resize and xhr post
View index.html
<!doctype html>
<html lang="en">
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
<div id="dragarea" class="drag-area"></div>
You can’t perform that action at this time.