Skip to content

Instantly share code, notes, and snippets.

View ayarushin's full-sized avatar
🌌
Through the Stars

Alexey Yarushin ayarushin

🌌
Through the Stars
View GitHub Profile
@ayarushin
ayarushin / useActionCreators.ts
Last active September 1, 2023 09:44
Redux hook for creating dispatchers
import { ActionCreator, ThunkAction, bindActionCreators,Action, AnyAction } from "@reduxjs/toolkit";
import { useMemo } from "react";
import { useDispatch } from "react-redux";
type BoundActions<Actions extends Array<ActionCreator<unknown>>> = {
[K in keyof Actions]: (
...args: Parameters<Actions[K]>
) => ReturnType<Actions[K]> extends ThunkAction<infer Return, unknown, unknown, AnyAction>
? Return
: ReturnType<Actions[K]>;
@ayarushin
ayarushin / mongodb.sh
Created September 19, 2016 17:40
Install MongoDB
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo bash -c " cat > /etc/systemd/system/mongodb.service <<EOF
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]