Or: “Everybody likes being given a glass of water.”
By Merlin Mann.
It's only advice for you because it had to be advice for me.
| #!/bin/sh | |
| # .git/hooks/commit-msg | |
| chksum="$( printf "%s" "$(< $1)" | sha256sum )" | |
| amulet="\e[5;1;48mYOU HAVE FOUND %s AMULET\e[0m\n" | |
| if grep 8888888888 > /dev/null <<< $chksum ; then | |
| printf "$amulet" "AN IMPOSSIBLE" | |
| elif grep 888888888 > /dev/null <<< $chksum ; then | |
| printf "$amulet" "A MYTHIC" | |
| elif grep 88888888 > /dev/null <<< $chksum ; then | |
| printf "$amulet" "A LEGENDARY" |
| // Load your Glitch project, paste this into the javascript console of chrome inspect | |
| // Enjoy vim goodness! | |
| (function () { | |
| var makeCursorFat = function() { | |
| var style = document.createElement('style'); | |
| style.textContent = | |
| 'div.CodeMirror div.CodeMirror-cursor { ' + | |
| 'width: auto; ' + | |
| 'border: 0; ' + |
| #!/usr/bin/python | |
| ''' | |
| Script to count messages by user posted to a channel for a given date range. | |
| Install: | |
| # sudo pip install slackclient | |
| Also you will need to obtain a slack API token: | |
| https://api.slack.com/docs/oauth-test-tokens |
| # Copyright (c) 2015 Heinrich Hartmann | |
| # MIT License http://choosealicense.com/licenses/mit/ | |
| import gdata.spreadsheet.service | |
| class GoogleDriveConnection(object): | |
| def __init__(self, email, password): | |
| self.client = gdata.spreadsheet.service.SpreadsheetsService() | |
| self.client.ClientLogin(email, password) | |
| VAN=`egrep -i "^...$" /usr/share/dict/words | perl -MList::Util=shuffle -e "print shuffle<STDIN>" | head -n 1 | tr "[:lower:]" "[:upper:]"` && \ | |
| LETTER=${VAN:1:1} && \ | |
| EAST=`egrep -i "^.${LETTER}..$" /usr/share/dict/words | perl -MList::Util=shuffle -e "print shuffle<STDIN>" | head -n 1 | tr "[:lower:]" "[:upper:]"` && \ | |
| echo " ${EAST:0:1}" && \ | |
| echo $VAN && \ | |
| echo " ${EAST:2:1}" && \ | |
| echo " ${EAST:3:1}" |
May 28, 2014
This code is a companion to the APIcon presentation Real-World Functional Programming by @jearldouglas and @kelleyrobinson. The slides are available here.
In this code, we compare imperative and functional implementations of a withdraw function that might be used in a banking ATM.
| package fsm | |
| import scala.annotation.implicitNotFound | |
| import scala.util.control._ | |
| import RefContext._ | |
| import Ref._ | |
| /** | |
| * Ref is a scoped type-safe mutable reference. | |
| * |
Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh
Easily checkout local copies of pull requests from remotes:
git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it outgit pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out| -optimizationpasses 5 | |
| -dontusemixedcaseclassnames | |
| -dontskipnonpubliclibraryclasses | |
| -dontpreverify | |
| -verbose | |
| -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* | |
| -renamesourcefileattribute SourceFile | |
| -keepattributes SourceFile,LineNumberTable |