<commit_before># Handlebars helpers
return if typeof Handlebars == 'undefined'

short_name = (user) ->
	return '' if not user or not user.name

	arr = user.name.split ' '
	return arr.slice(0, 2).join(' ') if arr[0].length <= 3

	if arr.length <= 1 then user.name else abbr(arr[0]) + arr[1].substr(0, 1)

abbr = (name) ->
	switch name.toLowerCase()
		when 'alexander' then 'Alex'
		when 'konstantin' then 'Kostya'
		else name

Meteor.Helpers = {} if not Meteor.Helpers
Meteor.Helpers.short_name = short_name

# formats as relative date
Handlebars.registerHelper "timeago", (date) ->
	'some time ago' if not date
	dateObj = new Date(date)
	moment(dateObj).fromNow().replace(/\ /g, '\u00a0')

# fetch avatar image from gravatar
Handlebars.registerHelper "gravatar", (email, size) ->
	Gravatar.imageUrl(email, {s: size, d: 'wavatar'})

Handlebars.registerHelper "short_name", (user) ->
	short_name user<commit_msg>using retro style for unknown gravatars<commit_after># Handlebars helpers
return if typeof Handlebars == 'undefined'

short_name = (user) ->
	return '' if not user or not user.name

	arr = user.name.split ' '
	return arr.slice(0, 2).join(' ') if arr[0].length <= 3

	if arr.length <= 1 then user.name else abbr(arr[0]) + arr[1].substr(0, 1)

abbr = (name) ->
	switch name.toLowerCase()
		when 'alexander' then 'Alex'
		when 'konstantin' then 'Kostya'
		else name

Meteor.Helpers = {} if not Meteor.Helpers
Meteor.Helpers.short_name = short_name

# formats as relative date
Handlebars.registerHelper "timeago", (date) ->
	'some time ago' if not date
	dateObj = new Date(date)
	moment(dateObj).fromNow().replace(/\ /g, '\u00a0')

# fetch avatar image from gravatar
Handlebars.registerHelper "gravatar", (email, size) ->
	Gravatar.imageUrl(email, {s: size, d: 'retro'})

Handlebars.registerHelper "short_name", (user) ->
	short_name user
{'fraction_non_alphanumeric': 0.14316702819956617, 'fraction_numerical': 0.013015184381778741, 'mean_word_length': 4.458579881656805, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4800987', 'n_tokens_mistral': 667, 'n_tokens_neox': 644, 'n_words': 188}