« first day (1426 days earlier)      last day (2691 days later) » 

04:54
@david hey man, ìn my express server I think I got the endpoint for the posts set up, but now I worry of it not being exactly secure. Is the following okay by itself or do I need to do something else?


```
router.post('/retrievePosts', function(req, res)) {
var posts = Post.paginate({}, {
page: page(),
limit: 10
}, function(err, result) {
console.log(result.docs)
res.send(result.docs)
})
}
```
1 message moved from JavaScript
 
7 hours later…
11:27
$.ajax({
method: 'GET',
url: $(this).attr('data-url'),
success: function(data){
//console.log(data);
$(this).parent().find('>.php-content').html(data);
}
});
1 message moved from JavaScript
 
6 hours later…
17:51
Hey, guys, I'm trying to make a custom sort function to sort dates but I'm having some trouble with it. So far I've come up with this:

array.sort(
function(a, b) {
var x = toDate(a);
var y = toDate(b);
return (x.getDate() < y.getDate() && x.getMonth() < y.getMonth() && x.getYear() < y.getYear()) ? x : y;
}
);
1 message moved from JavaScript
18:29
@Luggage Thanks for the tip. I have tried to applied what you said but it is still not working. I've changed my code to this:

array.sort(
function(a, b) {
var x = toDate(a);
var y = toDate(b);
return
(x.getDate() < y.getDate() && x.getMonth() < y.getMonth() && x.getYear() < y.getYear()) ? -1 :
(x.getDate() > y.getDate() && x.getMonth() > y.getMonth() && x.getYear() > y.getYear()) ? 1 :
0;
}
);
1 message moved from JavaScript
 
1 hour later…
user4710450
19:44
1 message moved from Teenage Territory

« first day (1426 days earlier)      last day (2691 days later) »