Skip to content

Instantly share code, notes, and snippets.

View Elergy's full-sized avatar

Evgenii Ponomarev Elergy

View GitHub Profile
@Elergy
Elergy / firefox-profiles-dialog.sh
Created February 24, 2015 05:57
open Firefox's Profiles dialog on MacOS
#! /bin/bash
/Applications/Firefox.app/Contents/MacOS/firefox-bin -p
@Elergy
Elergy / clone_docker
Created February 24, 2015 11:43
Clone from private repo
FROM <smt>
MAINTAINER <smo>
RUN apt-get update
# Install software
RUN apt-get install -y git
# Make ssh dir
RUN mkdir /root/.ssh/
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
or
sudo n 4.1.1
var noop = function() {};
describe('describe title', function() {
var i = 0;
beforeEach(function () {
if (i++ > 1) {
throw new Error('BEFORE EACH FAIL');
}
});
@Elergy
Elergy / code-to-refactor.js
Created February 6, 2019 23:18
Word ladder
function main() {
// code before
const shouldShowError = isOutsideInterval(value, minimum, maximum);
// code after
}
function isOutsideInterval(value, minimum, maximum) {
return value < minimum || value > maximum;
}
function main() {
// code before
const limits = { minimum, maximum };
const shouldShowError = isOutsideInterval(value, limits);
// code after
}
function isOutsideInterval(value, limits) {
return value < limits.minmum || value > limits.maximum;
}
@Elergy
Elergy / step-1.js
Last active February 6, 2019 23:30
// before
function isOutsideInterval(value, minimum, maximum) {
return value < minimum || value > maximum;
}
// after
function isOutsideInterval(value, minimum, maximum, limits) {
return value < minimum || value > maximum;
}
@Elergy
Elergy / step-2.js
Last active February 9, 2019 17:36
// before
const shouldShowError = isOutsideInterval(value, minimum, maximum);
// after
const shouldShowError = isOutsideInterval(value, minimum, maximum, {
minimum,
maximum
});
@Elergy
Elergy / step-3.js
Last active February 6, 2019 23:36
// before
function isOutsideInterval(value, minimum, maximum, limits) {
return value < minimum || value > maximum;
}
// after
function isOutsideInterval(value, minimum, maximum, limits) {
return value < limits.minimum || value > maximum;
}