Skip to content

Instantly share code, notes, and snippets.


Ivan Seniv seniv

View GitHub Profile
seniv /
Created Mar 18, 2020
Block commits on master and develop branches (add to "pre-commit" hook)
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ $BRANCH == 'develop' -o $BRANCH == 'master' ]
echo "ERROR: Making commits to master or develop branches are not allowed."
exit 1
seniv / BadApp.js
Last active Oct 21, 2019
Apollo Client performance
View BadApp.js
import React from 'react';
import { ApolloProvider, useSubscription } from '@apollo/react-hooks';
import { RootNavigator } from './navigation';
import { client } from './apollo';
import { mySubscription } from './graphql';
function App() {
useSubscription(mySubscription, {
// directly pass instance of apollo client because subscription used
// before ApolloProvider, and client cannot be taken from context
View snippets.code-snippets
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
"Import GraphQL Tag": {
"scope": "javascript,typescript,javascriptreact,typescriptreact",
"prefix": "imgql",
seniv /
Created Aug 26, 2018 — forked from soheilhy/
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for,, and on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

View MongoManager.js
const mongoose = require('mongoose');
class MongoManager {
constructor (config) {
this._config = config;
getMongoUrl() {
return this._config.MONGODB_URI;
connect () {