Skip to content

Instantly share code, notes, and snippets.

@hannu
hannu / gist:6433554
Created September 4, 2013 07:00
Max product of number sequence solution
function(input) {
var i=0; return _.max(_.map(input, function() {return _.reduce(input.substring(i++,i+4), function(o,m) {return o*m;})}))
}
@hannu
hannu / gist:4604611
Last active August 30, 2022 08:31
Filter your own commit messages from git log and group by day. (Modified from http://stackoverflow.com/questions/2976665/git-changelog-day-by-day)
#!/bin/bash
AUTHOR=$(git config user.name)
DATE=$(date +%F)
git log --no-merges --format="%cd" --date=short --no-merges --author="$AUTHOR" --all | sort -u -r | while read DATE ; do
if [ $NEXT != "" ]
then
echo
echo [$NEXT]
fi
GIT_PAGER=cat git log --no-merges --format=" %s" --since=$DATE --until=$NEXT --author="$AUTHOR" --all
@hannu
hannu / setup.sh
Created April 24, 2012 13:58
Development environment installation script for OS X
#!/usr/bin/env bash
# Development environmet installation script for OS X
# This script will
# - Install Homebrew (http://mxcl.github.com/homebrew/)
# - Install GIT
# - Run GIT/GitHub setup script (https://github.com/help/setup)
# - Setups default global .gitignore file
# - Install Oh-My-ZSH (https://github.com/robbyrussell/oh-my-zsh)
# - Install Ruby Version Manager (http://beginrescueend.com/)