Skip to content

Instantly share code, notes, and snippets.

@stillfinder
stillfinder / uninstall_mysql_script.sh
Last active January 17, 2019 22:24
Uninstall MySql on Mac script
#!/bin/bash
brew remove [email protected]
# Or 'brew remove mysql'
brew cleanup
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql*
sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
@stillfinder
stillfinder / uninstall_mysql.sh
Last active January 17, 2019 21:58
Uninstall MySql on Mac
brew remove mysql
brew cleanup
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql*
sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
#(Edit /etc/hostconfig) sudo nano /etc/hostconfig (Remove line MYSQLCOM=-YES) or run the next line
@stillfinder
stillfinder / drupal_install_console_error.sh
Created January 9, 2019 21:38
Install Drupal Console ERROR: "Can only install one of: symfony/debug"
composer require symfony/debug:3.4.8
composer require symfony/dom-crawler:3.4.9
composer require --dev drupal/console
@stillfinder
stillfinder / Branch_name_terminal_promtp.sh
Created January 9, 2019 21:35
Add branch name to terminal prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
@stillfinder
stillfinder / .gitconfig
Last active December 11, 2018 12:35
gitconfig aliases
[alias]
co = checkout
s = status
l = log
url = config --get remote.origin.url
# Git aliases
alias gb="git branch"
alias gaa="git add ."
alias gc="git commit -a -m"
alias gs="git status"
alias nah="git reset --hard; git clean -df;"
@stillfinder
stillfinder / generate-controller.sh
Last active November 30, 2018 09:18
generate-controller.sh
../vendor/bin/drupal generate:controller --module=custom_api --class=SearchController --routes='"title":"ControllerMethod", "name":"custom_api.search", "method":"search", "path":"custom_api/search/{search}"' --uri=my-site.com
@stillfinder
stillfinder / custom_api.routing.yml
Created November 29, 2018 23:41
custom_api.routing.yml
custom_api.search:
path: 'custom_api/search/{search}'
defaults:
_controller: '\Drupal\custom_api\Controller\SearchController::search'
_title: 'ControllerMethod'
requirements:
_permission: 'access content'
@stillfinder
stillfinder / SearchController.php
Created November 29, 2018 23:40
SearchController.php
<?php
namespace Drupal\custom_api\Controller;
use Drupal\Core\Controller\ControllerBase;
/**
* Class SearchController.
*/
class SearchController extends ControllerBase {
@stillfinder
stillfinder / LocalValetDriver-q-hack.php
Created November 27, 2018 04:08
LocalValetDriver ?q hack
<?php
if (!isset($_GET['q']) && !empty($uri) && $uri !== '/' && strpos($uri, '/jsonapi/') === false) {
$_GET['q'] = $uri;
}