Skip to content

Instantly share code, notes, and snippets.

@scottalan
scottalan / gist:80ea88b6cc2e42a997889b217e60ecb2
Created August 29, 2017 13:29 — forked from travist/gist:1648952
Determine how productive your team has been using git history.
git log --shortstat --since="1 year ago" --until="now" \
| grep "files changed\|Author\|Merge:" \
| awk '{ \
if ($1 == "Author:") {\
currentUser = $2;\
}\
if ($2 == "files") {\
files[currentUser]+=$1;\
inserted[currentUser]+=$4;\
deleted[currentUser]+=$6;\
@scottalan
scottalan / gist:a5070532effc715b199f66fbadeba720
Last active August 25, 2016 14:53
PhpStorm Debug Settings
These are the settings I use.
@scottalan
scottalan / .aliases
Last active March 9, 2017 13:57
Git: squash & rebase
# @arg int: The number of commits you want to squash.
function squash() {
num=${1};
if [ ! num ]; then
echo "Integer required";
return 0;
fi
git reset --soft HEAD~${num};
git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})";
}
@scottalan
scottalan / .aliases
Created August 18, 2016 02:55
XDegug: enable|disable
# Enable/Disable Xdebug
function x() {
if [ "$@" = "en" ]; then
sudo cp ~/vag-env/xdebug-en /etc/php.d/xdebug.ini
elif [ "$@" = "dis" ]; then
sudo cp ~/vag-env/xdebug-dis /etc/php.d/xdebug.ini
fi
}
@scottalan
scottalan / .aliases
Created August 18, 2016 02:52
Alias: Fix file permissions (Drupal)
fixfiles() {
# Drupal root.
drupal=$(drush dd)
retval=$?
echo "${retval}"
if [ $? -eq 0 ]; then
echo OK
@scottalan
scottalan / debug.md
Last active November 10, 2016 18:03
PHPStorm | Drush | Vagrant -- Debug

Getting started

I use Drupal VM with php5-fpm and it uses port 9000 so I just set my debug ports to 9001.

  • Set the debug port to 9001 in PHPStorm
  • Create a new server in PHPStorm:
    • Preferences >> Languages & Framworks >> Servers
    • Add a Name: and Host: e.g., mysite.dev (for both)
    • Click the checkbox: Use path mappings...
    • I always map my local DRUPAL_ROOT to my VM DRUPAL_ROOT
@scottalan
scottalan / file.css
Created August 3, 2016 12:26
Just CSS (jquery-outside-events/examples)
/* YUI RESETS */
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.5.2
*/
html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym {border:0;font-variant:normal;}sup {vertical-align:text-top;}sub {vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
@scottalan
scottalan / nvm.md
Last active March 11, 2024 03:21
NVM Install

Install NVM

curl https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash

Better but still could be bad!

curl -L https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh > /tmp/nvm-install.sh && bash /tmp/nvm-install.sh

Need to actually see it.

@scottalan
scottalan / nginx-conf.md
Last active July 26, 2016 15:03
Nginx - Location blocks

// This will match /my-path, /my-path/other/path/index.php, /my-path/index.html

location /my-path {
    . . .
}

// Exact path matching.

@scottalan
scottalan / commands.sh
Created July 25, 2016 15:46
Atlassian
atlas-run-standalone -p 4444 --server "mastervm.dev" --product crowd