Skip to content

Instantly share code, notes, and snippets.

View oleg-am's full-sized avatar

Oleg Avgustinov oleg-am

View GitHub Profile
@oleg-am
oleg-am / git-change-commit-messages.md
Created July 24, 2020 10:39 — forked from nepsilon/git-change-commit-messages.md
How to change your commit messages in Git? — First published in fullweb.io issue #55

How to change your commit messages in Git?

At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.

Not pushed + most recent commit:

git commit --amend

This will open your $EDITOR and let you change the message. Continue with your usual git push origin master.

@oleg-am
oleg-am / routes.js
Last active November 19, 2017 20:49
react-tabs
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 September 21, 2017 11:17 — forked from timneutkens/index.js
Save PDF using javascript (isomorphic-fetch and file-saver)
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 September 16, 2017 11:16
Default global packages for NVM
create-react-app
generator-generator
pm2
yo
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),
},
};