Skip to content

Instantly share code, notes, and snippets.

View Rulsky's full-sized avatar

Ruslan Zaytsev Rulsky

View GitHub Profile
@Rulsky
Rulsky / gist:f0219e1d26e2cc66fbd968e0a5249c64
Created December 9, 2016 00:40 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@Rulsky
Rulsky / gulpfile.js
Created January 6, 2017 22:38
gulp error swallowing with plumber
const gulp = require('gulp'),
sass = require('gulp-sass'),
sourcemaps = require('gulp-sourcemaps'),
autoprefixer = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),
newer = require('gulp-newer'),
concat = require('gulp-concat'),
plumber = require('gulp-plumber'),
notify = require('gulp-notify'),
bs = require('browser-sync');
@Rulsky
Rulsky / js-get-fn-name.js
Created August 15, 2017 23:00 — forked from dfkaye/js-get-fn-name.js
get a javascript function name
function getFnName(fn) {
var f = typeof fn == 'function';
var s = f && ((fn.name && ['', fn.name]) || fn.toString().match(/function ([^\(]+)/));
return (!f && 'not a function') || (s && s[1] || 'anonymous');
}
console.log(getFnName(String)); // 'String'
console.log(getFnName(function test(){})); // 'test'
console.log(getFnName(function (){})); // 'anonymous'
@Rulsky
Rulsky / optimiseImage.js
Created August 31, 2017 13:22
image optimisation via canvas api
/**
* @description promisified optimisation of image via canvas API
*
* @param {File} file - a file of an image which should be transformed
* @param {integer} destHeight - a desired height of an output image Blob|DataURL
* @param {integer} quality - a desired level of compression of an output image Blob|DataURL
* @param {string} mimeType - mimeType of of an output image Blob|DataURL
* @param {string} to - part of canvas conversion method name (can be 'DataURL' or 'Blob' as a `Canvas.toDataURL()` or `Canvas.toBlob()`)
*
* @return {Promise}
@Rulsky
Rulsky / mesh.css
Created March 23, 2018 11:05
a mesh-like grid in css
:root {
--grid-color: rgba(100, 180, 120, .2)
}
html {
position:relative;
}
html:after {
position: absolute;
width: auto;
height: auto;
@Rulsky
Rulsky / .eslintrc.json
Last active October 4, 2018 12:14
all basics that required for bootstrapping new project with firebase-react-app
{
"parser": "babel-eslint",
"extends": "airbnb",
"plugins": [
"babel"
],
"env": {
"browser": true,
"jest": true,
"node": true