Skip to content

Instantly share code, notes, and snippets.

View NorikDavtian's full-sized avatar
🚢
Shipping

Norik Davtian NorikDavtian

🚢
Shipping
View GitHub Profile
@NorikDavtian
NorikDavtian / eslint-git-pre-commit-hook
Last active October 25, 2018 23:41
ESLint git pre commit hook
#!/usr/bin/env python
#
# 1. Save this file as `pre-commit` in your local .git/hooks/ directory
# 2. Make sure your file is executable `chmod +x pre-commit`
# Upon git commit, this script will check your staged files against your eslint ruleset
# More flags and options at http://eslint.org/
import os, sys
"""
@NorikDavtian
NorikDavtian / resume_after_next.md
Created December 4, 2015 03:28 — forked from mikedeboer/resume_after_next.md
Why to call resume() after next()

When we write Connect middlewares that contain async operations, it is good practice to 'pause' the HTTP request with the help of the Connect utility function. When the async operation has finished, the HTTP request is resumed again. Let's have a look at the documentation for this utility:

Pause `data` and `end` events on the given `obj`.
Middleware performing async tasks _should_ utilize
this utility (or similar), to re-emit data once
the async operation has completed, otherwise these
events may be lost.
@NorikDavtian
NorikDavtian / is_installed.sh
Created December 11, 2015 12:27 — forked from JamieMason/is_installed.sh
Check if a program exists from a bash script. Thanks to twitter.com/joshnesbitt and twitter.com/mheap for the help with detecting npm packages.
#!/bin/bash
# Functions ==============================================
# return 1 if global command line program installed, else 0
# example
# echo "node: $(program_is_installed node)"
function program_is_installed {
# set to 1 initially
local return_=1
@NorikDavtian
NorikDavtian / edit-git-config.sh
Created May 23, 2017 23:20
edit global git config
git config --global --edit
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
quote_type = single
@NorikDavtian
NorikDavtian / LICENSE
Last active April 28, 2018 09:51
LICENSE
MIT License
Copyright (c) 2018 Norik Davtian
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@NorikDavtian
NorikDavtian / .bash_aliases
Created May 31, 2017 00:51
Docker cleanup bash aliases
# ~/.bash_aliases
# https://www.calazan.com/docker-cleanup-commands/
# Kill all running containers.
alias dockerkillall='docker kill $(docker ps -q)'
# Delete all stopped containers.
alias dockercleanc='printf "\n>>> Deleting stopped containers\n\n" && docker rm $(docker ps -a -q)'
# Delete all untagged images.
git clone --depth 1 -b $src_branch $repo_src_url $dir
# add this function to your bash profile, in my case ~/.zshrc
# FROM: https://dev.to/ricardomol/note-taking-from-the-command-line-156
# Examples:
#
# notes <<NOTE
# This is a very long note
# because sometimes I like
# to write explanations of
# my commands and such.
# NOTE
"email":.?"[a-z|A-Z|0-9|@|\.]*