Skip to content

Instantly share code, notes, and snippets.

View KitsonBroadhurst's full-sized avatar
:bowtie:
Building!

Kitson Broadhurst KitsonBroadhurst

:bowtie:
Building!
View GitHub Profile
@bobmacneal
bobmacneal / CypressSockJsNodeStub.js
Created December 23, 2019 15:12
Cypress Command to Stub /sockjs-node/info?t=*
Cypress.Commands.add('mockSockJs', () => {
const url = '/sockjs-node/info?t=*'
cy.server()
cy.route({
method: 'GET',
url: url,
response: 'fixture:sockJs.json',
})
})
@Orangetronic
Orangetronic / for_each_db.js
Created May 30, 2019 13:10
run a command across all the databases in mongo from the Studio 3T mongo shell
db = db.getSiblingDB("admin");
dbs = db.runCommand({ "listDatabases": 1 }).databases;
// Iterate through each database and get its collections.
dbs.forEach(function(database) {
db = db.getSiblingDB(database.name);
});
@CrookedNumber
CrookedNumber / gist:8964442
Created February 12, 2014 21:02
git: Removing the last commit

Removing the last commit

To remove the last commit from git, you can simply run git reset --hard HEAD^ If you are removing multiple commits from the top, you can run git reset --hard HEAD~2 to remove the last two commits. You can increase the number to remove even more commits.

If you want to "uncommit" the commits, but keep the changes around for reworking, remove the "--hard": git reset HEAD^ which will evict the commits from the branch and from the index, but leave the working tree around.

If you want to save the commits on a new branch name, then run git branch newbranchname before doing the git reset.