This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export WORKON_HOME=/home/kiril/.virtualenvs | |
export PROJECT_HOME=/home/kiril/projects | |
export VIRTUALENV_PYTHON=/usr/bin/python3 | |
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 | |
source /usr/local/bin/virtualenvwrapper.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eval "$(direnv hook bash)" | |
show_virtual_env() { | |
if [ -n "$VIRTUAL_ENV" ]; then | |
echo "($(basename $VIRTUAL_ENV)) " | |
fi | |
} | |
PS1='$(show_virtual_env)'$PS1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const defaultdict = (getDefault) => | |
new Proxy( | |
{}, | |
{ | |
get: (target, key) => { | |
if (!Reflect.has(target, key)) | |
Reflect.set( | |
target, | |
key, | |
typeof getDefault === "function" ? getDefault() : getDefault |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let disabled = false; | |
let disabledMap = new WeakMap(); | |
let storage = new WeakMap(); | |
const hasMemoizedProperty = (obj, propName) => { | |
if (!storage.has(obj)) storage.set(obj, {}); | |
const props = storage.get(obj); | |
if (propName in props) return true; | |
return false; | |
}; | |
const getMemoizedProperty = (obj, propName) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const combineRootWithReducers = ({ | |
root = () => ({}), // reducer which should be on the root level of global state | |
reducers = {}, // other reducers | |
initial = {}, // initial state of global state | |
rootLast = false // if true, root reducer will be called after other reducers | |
}) => { | |
/* | |
this method allows you to combine basic reducers with a reducer which | |
manages state on the root level of global state | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class AxiosTokenHelper { | |
/* | |
This helper allows you to cancel old api calls, if new | |
one occurs. | |
const helper = new AxiosTokenHelper(); | |
const callToApi = async (...) => { | |
const source = helper.create(); | |
try { | |
const response = await axios.get( |