Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# MySQL Backup Script
# VER. 2.5 - http://sourceforge.net/projects/automysqlbackup/
# Copyright (c) 2002-2003 wipe_out@lycos.co.uk
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
@thagler
thagler / revert_commit.git
Created September 13, 2016 15:57
Remove the latest commit from a branch already pushed to origin
For a list of the most recent commits
`git log --pretty=oneline --abbrev-commit`
Go back 1 commit to remove
`git rebase -i HEAD~1`
replace ‘pick’ with ‘drop’ in that commit line and save (should be in vi)
`git push origin +my/branch-name`
Note: push +branch_name is like --force, but slightly less of a jerk about it
@thagler
thagler / get_node_by_path.php
Created September 16, 2016 02:40
Drupal 8 Get node ID by path alias
<?php
$path = \Drupal::service('path.alias_manager')->getPathByAlias('/this-is-the-alias');
if(preg_match('/node\/(\d+)/', $path, $matches)) {
$node = \Drupal\node\Entity\Node::load($matches[1]);
}