Skip to content

Instantly share code, notes, and snippets.

Oleg Avgustinov oleg-am

Block or report user

Report or block oleg-am

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@oleg-am
oleg-am / routes.js
Last active Nov 19, 2017
react-tabs
View routes.js
import React, { Component } from 'react';
import { Switch, Route, Redirect, withRouter } from 'react-router-dom';
import Loadable from 'react-loadable';
const tabs = require('../tabs.json');
class Routes extends Component {
state = {}
componentDidMount() {
@oleg-am
oleg-am / index.js
Created Sep 21, 2017 — forked from timneutkens/index.js
Save PDF using javascript (isomorphic-fetch and file-saver)
View index.js
import fetch from 'isomorphic-fetch'
import { saveAs } from 'file-saver'
fetch('/url/with/pdf', {
headers: {
'Content-Type': 'application/pdf'
},
responseType: 'blob'
}).then(response => response.blob())
.then(blob => saveAs(blob, 'test.pdf'))
@oleg-am
oleg-am / default-packages
Created Sep 16, 2017
Default global packages for NVM
View default-packages
create-react-app
generator-generator
pm2
yo
View setValue.js
const setValue = (state, key, value, obj = false) => {
if (Array.isArray(key) && key.length > 1) {
const keys = [...key];
const currentKey = keys.shift();
return {
[currentKey]: {
...state[currentKey],
...setValue(state[currentKey], keys, value, true),
},
};
You can’t perform that action at this time.