Skip to content

Instantly share code, notes, and snippets.

View jcollum's full-sized avatar

Justin Collum jcollum

View GitHub Profile
@tobym
tobym / pwdx_for_mac.bash
Created October 27, 2010 01:03
pwdx for mac. Usage: pwx pid
function pwdx {
lsof -a -p $1 -d cwd -n | tail -1 | awk '{print $NF}'
}
@durran
durran / query.rb
Created December 9, 2011 09:40
ML query
# 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 }}
@monolithed
monolithed / index.html
Last active February 1, 2017 18:23 — forked from iketari/index.html
Object.keys vs for..in #jsbench #jsperf (http://jsbench.github.io/#9edc79f26350c0e90d8dddb48dc19f31) #jsbench #jsperf
<!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>
@bag-man
bag-man / database.js
Last active July 22, 2019 22:46
Connect and use MongoDB with ES6 in Node 4
'use strict'
const MongoClient = require('mongodb')
class Database {
constructor (uri) {
this.uri = uri
this.db = {}
return this