Skip to content

Instantly share code, notes, and snippets.

View marcel-jahn's full-sized avatar

Marcel Jahn marcel-jahn

  • Rewe Group Toom Baumarkt
  • Cologne
View GitHub Profile
@marcel-jahn
marcel-jahn / gist:65193ebce407f56cba1c6041074c8107
Created August 3, 2017 12:25
Sorting by ascending date with Underscore.js
var list = [
{id: 1, created_at: 'Sun Feb 22 23:19:08 +0000 2009'},
{id: 2, created_at: 'Wed Jun 05 14:07:04 +0000 2013'},
{id: 3, created_at: 'Wed Jun 05 10:11:30 +0000 2013'},
{id: 3, created_at: 'Wed Jun 05 14:01:08 +0000 2013'}
];
var sorted = _.sortBy(list,function(node){
return - (new Date(node.created_at).getTime());
});
@marcel-jahn
marcel-jahn / RegExp: find Urls
Last active August 29, 2015 14:26
RegExp: find Urls
/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?)/g