install oh my zsh
open branch:
gco -b FOLDER_NAME/FEATURE_NAMEcreates new branch locallyggpushcreates a remote branch
| new VM!! | |
| first of all to set the command prompt, add this to ~/.profile and change the text needed to change: | |
| PS1="\u@\e[0;31mTHISTEXTCHANGE\e[m \w $ \e[m" | |
| next, install avahi: sudo apt-get install avahi-daemon | |
| now you can log in by the hostname dot local!! | |
| sudo apt-get install build-essential | |
| git dependencies: sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev |
| # Adding time stamp to the russel theme | |
| PROMPT='%{$fg_bold[yellow]%}%T% %{$fg_bold[red]%} ➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' | |
| ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" | |
| ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
| ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" | |
| ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" |
| #!/bin/sh | |
| branch=`git rev-parse --abbrev-ref HEAD` | |
| echo "Running tests before pushing...." | |
| if [[ $branch == 'master' || $branch == 'develop' ]]; | |
| then | |
| # SET IT TO YOUR OWN VIRTUALENV PATH ! | |
| source ~/virtualenv/mp_api/bin/activate |
install oh my zsh
open branch:
gco -b FOLDER_NAME/FEATURE_NAME creates new branch locallyggpush creates a remote branch| // First we define callbacks | |
| const asyncHook = async_hooks.createHook({ init, before, after, destroy, promiseResolve }); | |
| // Then we enable the hooks | |
| asyncHook.enable(); |
| const fs = require('fs'); | |
| const async_hooks = require('async_hooks'); | |
| async_hooks.createHook({ | |
| init(asyncId, type, triggerAsyncId) { | |
| fs.writeSync(1, `Init ${type} resource: asyncId: ${asyncId} trigger: ${triggerAsyncId}\n`); | |
| }, | |
| destroy(asyncId) { | |
| const eid = async_hooks.executionAsyncId(); | |
| fs.writeSync(1, `Destroy resource: execution: ${eid} asyncId: ${asyncId}\n`); | |
| } |
| Calling setTimeout: execution: 1 | |
| Init Timeout resource: asyncId: 6 trigger: 1 | |
| Init TIMERWRAP resource: asyncId: 7 trigger: 1 | |
| Inside setTimeout: execution: 6 | |
| Destroy resource: execution: 0 asyncId: 6 | |
| Destroy resource: execution: 0 asyncId: 7 |
| // node-request-context/namespace.js | |
| const asyncHooks = require('async_hooks'); | |
| class Namespace { | |
| constructor() { | |
| this.context = {}; | |
| } | |
| run(fn) { |
| // node-request-context/index.js | |
| const Namespace = require('./namespace'); | |
| const namespaces = {}; | |
| function createNamespace(name) { | |
| if (namespaces[name]) { throw new Error(`A namespace for ${name} is already exists`); } | |
| const namespace = new Namespace(); | |
| namespaces[name] = namespace; | |
| createHooks(namespace); // wait for explanation below |
| // node-request-context/index.js | |
| const asyncHooks = require('async_hooks'); | |
| function createHooks(namespace) { | |
| function init(asyncId, type, triggerId, resource) { | |
| // Check if trigger has context | |
| // Or in other words, check if tigger is part of any request | |
| if (namespace.context[triggerId]) { | |
| // Here we keep passing the context from | |
| // the triggerId to the new asyncId |