Skip to content

Instantly share code, notes, and snippets.

View anvk's full-sized avatar
⌨️
coding my way through life

Alexey Novak anvk

⌨️
coding my way through life
View GitHub Profile
@anvk
anvk / psql_useful_stat_queries.sql
Last active April 16, 2024 22:45
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
@anvk
anvk / promises_reduce.js
Last active October 11, 2023 09:02
Sequential execution of Promises using reduce()
function asyncFunc(e) {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(e), e * 1000);
});
}
const arr = [1, 2, 3];
let final = [];
function workMyCollection(arr) {
@anvk
anvk / gist:3e0b3630e64edc4e08bba56e9afd1640
Created August 18, 2023 13:31
Last 10 branches in Git
git for-each-ref --sort=-committerdate --count=10 --format='%(refname:short)' refs/heads/
@anvk
anvk / funTypeScriptChallenge.ts
Last active November 7, 2022 15:56
Fun TypeScript challenge
/*
* TypeScript challenge for anyone to flex their TS dev skills
*
* Write a function wrapper that accepts any arbitrary function with arbitrary arguments.
* This wrapper should output a new function that is a modified version of the original one.
* This new function should have an extra argument which is last in the list of arguments. This argument is boolean and optional, named "verbose".
* This new function works exactly like the original one, with the exception that it should output "verobse is on!" when
* "verbose" argument is set to true.
*/
@anvk
anvk / git_housekeeping.sh
Last active June 21, 2022 02:50
Remote branch cleanup in Git
#!/bin/bash
# This Gist was inspired by the following posts:
# https://nickymeuleman.netlify.app/blog/delete-git-branches
# https://railsware.com/blog/git-housekeeping-tutorial-clean-up-outdated-branches-in-local-and-remote-repositories/
#
# This command helps find all stale non-merged branches on your remote that are more than X weeks old
#
# ARGUMENTS:
@anvk
anvk / deep_extend_javascript_objects.js
Last active September 19, 2020 04:01
Deep Extend for Javascript Objects (my polyfill for _.merge() function)
/* MIT license
* 2015 Alexey Novak
*
* Inspired by http://youmightnotneedjquery.com/ with few of my own modifications
*
**/
var deepExtend = function(out) {
out = out || {};
@anvk
anvk / aliases.sh
Created November 16, 2017 15:11
Alias commands
alias gti='git'
alias ll='ls -la'
alias mymongo='mongod --dbpath /Users/anvk/Documents/mongo.data/db/'
alias mypsql='postgres -D /usr/local/var/postgres'
alias mychange='git add . && git commit -m "change" && git rebase -i HEAD~2 && git push -f --set-upstream origin'
alias mykillemmulator='$ANDROID_HOME/platform-tools/adb -s emulator-5554 emu kill'
alias mypush='git push -f -u origin HEAD'
alias myrebase='git checkout develop && git fetch upstream && git pull upstream develop && git checkout - && git rebase develop'
@anvk
anvk / my_bash.sh
Last active September 2, 2019 12:34
Tiny change quick rebase in GIT
# First set your git config to push only current branch
# This will change default behaviour of your GIT push command
# instead of pushing all changed branches from your local repo to the remote
# it will push ONLY your CURRENT branch you are on to the remote
git config --global push.default simple
# Add this alias to your ~/.bash_profile (OSX, Linux) or ~/.bashrc (Windows + Git Bash)
vim ~/.bash_profile
# If you have not setup your branch to track remote one. CUR_BRANCH is the name of the branch you are working with
@anvk
anvk / deleteAllGitBranchesExceptOfDevelop
Created May 1, 2018 13:41
Delete all Git local branches except of develop
git branch | grep -v "develop" | xargs git branch -D
@anvk
anvk / GIF-Screencast-OSX.md
Created April 11, 2017 14:17 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: