Skip to content

Instantly share code, notes, and snippets.

View EvgenyArtemov's full-sized avatar
🎯
Focusing

Evgeny Artemov EvgenyArtemov

🎯
Focusing
View GitHub Profile
@EvgenyArtemov
EvgenyArtemov / add_to_path.txt
Last active January 19, 2021 15:20
Add to the $PATH MacOS
In the process of setting up a new Mac, I installed node.js. After the node.js installer finished, it recommended to add /usr/local/share/npm/bin to my path. It turns out there is a very neat way to do this in OS X, the /etc/paths file! The file contains a list (one per line) of paths that are added to the $PATH variable in the shell. Here are some quick directions to add to the path:
##Open up Terminal.
Run the following command:
sudo nano /etc/paths
Enter your password, when prompted.
Go to the bottom of the file, and enter the path you wish to add.
Hit control-x to quit.
Enter “Y” to save the modified buffer.
@EvgenyArtemov
EvgenyArtemov / branch-fu.md
Created April 2, 2021 12:25 — forked from unbracketed/branch-fu.md
Moving commits between branches

Example: Moving up to a few commits to another branch

Branch A has commits (X,Y) that also need to be in Branch B. The cherry-pick operations should be done in the same chronological order that the commits appear in Branch A.

cherry-pick does support a range of commits, but if you have merge commits in that range, it gets really complicated

git checkout branch-B
git cherry-pick X
git cherry-pick Y
@mixin firefox-only {
@at-root {
@-moz-document url-prefix() {
& {
@content;
}
}
}
}
@EvgenyArtemov
EvgenyArtemov / responsive.scss
Created May 5, 2021 15:33
Responsive media queries ScSS
$small-desktop: 960px;
$large-desktop: 1200px;
$tablet: 768px;
$tablets-landscape: 1024px;
$mobile: 480px;
$mobile-landscape: 640px;
@mixin response($media) {
@if $media == largeDesktop {
@media only screen and (min-width: $large-desktop) { @content }
const putAt = (path, obj, value) => {
const ObjCopy = {...obj};
const arrPath = path.split('.').reverse();
const copy = arrPath.reduce((acc, name, i) => {
const temp = {};
if(i === 0) {
temp[name] = value;
} else {
temp[name] = {...acc};
@EvgenyArtemov
EvgenyArtemov / requestIdleCallback__debounce.js
Created November 27, 2021 16:18
requestIdleCallback__debounce
//based on http://modernjavascript.blogspot.de/2013/08/building-better-debounce.html
var debounce = function(func) {
var timeout, timestamp;
var wait = 99;
var run = function(){
timeout = null;
func();
};
var later = function() {
var last = Date.now() - timestamp;
@EvgenyArtemov
EvgenyArtemov / compose.js
Created June 30, 2022 07:48 — forked from jperasmus/compose.js
"compose" function that handles both sync and async functions
// Async compose
const compose = (…functions) => input => functions.reduceRight((chain, func) => chain.then(func), Promise.resolve(input));
// Functions fn1, fn2, fn3 can be standard synchronous functions or return a Promise
compose(fn3, fn2, fn1)(input).then(result => console.log(`Do with the ${result} as you please`))