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 / 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
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|@|\.]*

JS Decorators Example for Redux Connect

In general, this would be used as follows:

class MyReactComponent extends React.Component {}

export default connect(mapStateToProps, mapDispatchToProps)(MyReactComponent);

However, because of how the decorator syntax works, this can be replaced with:

@connect(mapStateToProps, mapDispatchToProps)
$ docker system prune -a

WARNING! This will remove:
	- all stopped containers
	- all volumes not used by at least one container
	- all networks not used by at least one container
	- all images without at least one container associated to them
Are you sure you want to continue? [y/N] y
# git rebase --onto <branch name>~<first commit number to remove> <branch name>~<first commit to be kept> <branch name>
git rebase --onto repair~3 repair~1 repair