Skip to content

Instantly share code, notes, and snippets.

@ntim
ntim / .gitignore
Last active August 29, 2015 14:26 — forked from kogakure/.gitignore
Git: .gitignore file for (Xe)LaTeX projects
*.aux
*.glo
*.idx
*.log
*.toc
*.ist
*.acn
*.acr
*.alg
*.bbl
@ntim
ntim / distance_of_time_in_words.coffee
Last active August 29, 2015 14:25 — forked from sulf/gist:1157909
Rails helper time_ago_in_words() and distance_of_time_in_words() translated into an AngularJs filter in CoffeScript
app.filter('distance_of_time_in_words', ->
(from_time, to_time, include_seconds) ->
include_seconds = include_seconds || true
to_time = to_time || 0
distance_in_minutes = Math.round(Math.abs(to_time - from_time) / 60 / 1000)
distance_in_seconds = Math.round(Math.abs(to_time - from_time) / 1000)
if 0 <= distance_in_minutes and distance_in_minutes <= 1
if !include_seconds
if distance_in_minutes == 0
return 'less than 1 minute ago'