Skip to content

Instantly share code, notes, and snippets.

View joelcrocker's full-sized avatar

Joel Crocker joelcrocker

  • PagerDuty
  • Toronto, ON
View GitHub Profile
angular.module("ui-utils-too", []).
directive("scrollfollow", ["$window", ($window) ->
restrict: "A"
link: (scope, el, attrs) ->
window = angular.element($window)
parent = angular.element(el.parent())
currentOffsetTop = el[0].getBoundingClientRect().top
headerOffsetTop = scope.$eval(attrs.scrollfollow) or 5
# assumes width/padding in px

Keybase proof

I hereby claim:

  • I am joelcrocker on github.
  • I am joelcrocker (https://keybase.io/joelcrocker) on keybase.
  • I have a public key whose fingerprint is E4A4 B053 3145 D7F6 1CD4 CEE6 EF6C 2D68 DC73 6AE2

To claim this, I am signing this object:

@joelcrocker
joelcrocker / group_tuples.py
Last active December 28, 2015 20:19
Tuple grouping function. Useful for collapsing tabular data from left to right. Uses toolz; see http://toolz.readthedocs.org/en/latest/ See usage.txt below for examples.
from toolz.itertoolz.core import reduceby
from toolz.dicttoolz.core import valmap
def group_tuples(tuples):
if len(tuples[0]) < 2:
return [t[0] for t in tuples]
result = reduceby(
lambda t: t[0],
lambda a, b: a + [b[1:]],
tuples,