This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const MongoClient = require('mongodb') | |
class Database { | |
constructor (uri) { | |
this.uri = uri | |
this.db = {} | |
return this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>Object.keys vs for..in #jsbench #jsperf</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the count of notifications for this user | |
# and this post that need to be sent or have *not* | |
# been sent in the past 24 hours | |
User. | |
where({ _id: user._id, "notifs.post_id" => post_id }). | |
any_of( | |
{ "notifs.needs_send" => true }, | |
{ "notifs.last_send" => { '$exists' => false }}, | |
{ "notifs.last_send" => { "$lt" => 1.days.ago.utc }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pwdx { | |
lsof -a -p $1 -d cwd -n | tail -1 | awk '{print $NF}' | |
} |