Skip to content

Instantly share code, notes, and snippets.

View hoangtrieukd's full-sized avatar

hoangtrieukd hoangtrieukd

View GitHub Profile
@hoangtrieukd
hoangtrieukd / dom-to-json.js
Created September 17, 2019 03:59 — forked from sstur/dom-to-json.js
Stringify DOM nodes using JSON (and revive again)
function toJSON(node) {
node = node || this;
var obj = {
nodeType: node.nodeType
};
if (node.tagName) {
obj.tagName = node.tagName.toLowerCase();
} else
if (node.nodeName) {
obj.nodeName = node.nodeName;
@hoangtrieukd
hoangtrieukd / App.js
Created January 17, 2019 15:42 — forked from madcoda/App.js
React-router v4 multi layout
import React, { Component } from 'react'
import { BrowserRouter as Router, Route, Link, Match, Redirect, Switch } from 'react-router-dom'
import OverviewPage from './page/OverviewPage'
import AccountPage from './page/AccountPage'
/*
Layouts, inline define here for demo purpose
you may want to define in another file instead
*/

From this answer: https://stackoverflow.com/a/17141512/6307412

git checkout my-branch
git branch -m my-branch-old # this will rename 'my-branch' to 'my-branch-old'
git checkout master
git checkout -b my-branch
git merge --squash my-branch-old
git commit -m "...your message..."
git push origin my-branch --force # add --force to rewrite history on remote if neccessary