Skip to content

Instantly share code, notes, and snippets.

Serg Hospodarets malyw

Block or report user

Report or block malyw

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
malyw / index.js
Last active Apr 24, 2020
Capture DOM element screenshot using Chrome headless
View index.js
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Adjustments particular to this page to ensure we hit desktop breakpoint.
page.setViewport({width: 1000, height: 600, deviceScaleFactor: 1});
await page.goto('', {waitUntil: 'networkidle'});
malyw / Find unused SCSS variables
Last active Dec 28, 2017
Script finds all SCSS variables (e.g. $some_variable-NAME1) which are used in code only once (e.g. declaration or using variable from some framework). Tested on MAC and Linux.
View Find unused SCSS variables
#!/usr/bin/env bash
# Save code to file
# e.g "./ ./sass"
find "$1" -type f -name "*.scss" -exec grep -o "\$[$VAR_NAME_CHARS]*" {} ';' | sort | uniq -u
malyw /
Last active May 2, 2017
Delete all the local Git branches except the current one
#!/usr/bin/env bash
git branch | grep -v (git rev-parse --abbrev-ref HEAD) | xargs git branch -D
malyw /
Last active May 2, 2017
Remove Git branches, which are merged to the current one (+ ability to exclude some of them)
#!/usr/bin/env bash
# based on
# list
git branch -r --merged | grep origin | grep -v '>' | grep -v master\* | grep -v release-\* | xargs -L1
# delete
git branch -r --merged | grep origin | grep -v '>' | grep -v master\* | grep -v release-\* | xargs -L1 | awk '{sub(/origin\//,"");print}' | xargs git push origin --delete
malyw / .htaccess
Created Feb 15, 2017 — forked from darcyliu/.htaccess
Apache GZIP compression and Expires headers
View .htaccess
<IfModule mod_deflate.c>
# Enabling Compression
SetOutputFilter DEFLATE
# Insert filters
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
malyw / gist:f300a5f804f62e37392864ce2f0b733c
Created Dec 28, 2016
Push failed: Failed with error: unable to access '': The requested URL returned error: 403
View gist:f300a5f804f62e37392864ce2f0b733c
$ vim .git/config
malyw / killProcessByPort.js
Created Dec 18, 2016
Script takes the port as a param and tries to find and kill a process which is listening the port, e.g. `node killProcessByPort.js 8080`
View killProcessByPort.js
#!/usr/bin/env node
* Script takes the port as a param and tries to find and kill a process
* which is listening the port
* Example of the script usage:
malyw / Native JavaScript promises API
Last active Sep 26, 2016
Description of the native JavaScript promises API with examples
View Native JavaScript promises API
// Current browser support for native promises:
// Article:
// Polyfills:
/*------------------------------ GET PROMISE ------------------------------*/
// N.B.: Promises pass only first argument to resolve/reject callbacks, others are ignored
function doSomething(){
return new Promise(function(resolve, reject) {
malyw /
Last active Aug 5, 2016
Script to kill all the processes which established connection to the port.Usage: './ 35729' (clear the livereload port)
#!/usr/bin/env bash
function terminate {
echo ':'$1
lsof -P | grep ':'$1 | awk '{print $2}' | xargs kill -9
terminate $1
You can’t perform that action at this time.