Skip to content

Instantly share code, notes, and snippets.

View RandallShanePhD's full-sized avatar
Coffee & Code!

Randall Shane, PhD RandallShanePhD

Coffee & Code!
View GitHub Profile
@RandallShanePhD
RandallShanePhD / arraySort.js
Created January 8, 2017 16:38
Sort an Array in JavaScript
const arr0 = [{'name': 'Davis', 'age': 63}, {'name': 'Melissa', 'age': 28}, {'name': 'John', 'age': 57}, {'name': 'Emma', 'age': 16}]
const arr0sorted = arr0.sort((a, b) => a.age > b.age);
@RandallShanePhD
RandallShanePhD / objectids.py
Created July 28, 2014 20:59
Decode and Encode object ids in MongoDB using pymongo
# MongoDB Object ID decode
# Randall Shane, PhD
# RShane@BaseXVI.com
# BaseXVI.com
# 28 July 2014
'''MongoDB creates a unique id ('_id' key) for every document
which is a 12 byte object comprised of 4 parts as follows:
time stamp: 4 bytes