Skip to content

Instantly share code, notes, and snippets.

@scottalan
scottalan / gist:6be57f9a9d7af0e1d778634c22177872
Created August 29, 2017 21:36 — forked from travist/gist:1677353
Determine the diff provided a Story ID.
git log\
| grep "Merge pull request.*{INSERT STORY ID HERE}" -B 5\
| awk '{\
if ($1=="commit") {\
print system("git diff " $2 "^ " $2);\
}\
}'
@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 / 0_reuse_code.js
Created July 19, 2016 15:30
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
/**
* Change content from one input format to another, deleting the old at the end.
*
* @param string $old_format
* Name of the old input format.
* @param string $new_type
* Name of the new input format.
*/
function _myprofile_install_change_input_format($old_format, $new_format) {
// Change the format on all fields.
php -i | grep 'Configure Command =>' | awk '{for(i=5; i<=NF; i++) {print substr($i, 2, (length($i) - 2))}}'

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@scottalan
scottalan / gist:1022898
Created June 13, 2011 14:49 — forked from glennpratt/gist:1016744
DateTime.php
$ php -a
Interactive shell
php > $date = new DateTime('now');
php > $timestamp = $date->format('U');
php > var_dump($timestamp);
string(10) "1307626589"
php > $timestamp = $date->getTimestamp();
php > var_dump($timestamp);
int(1307626589)