Skip to content

Instantly share code, notes, and snippets.

View matthewbordas's full-sized avatar

Matt Bordas matthewbordas

View GitHub Profile
module.exports = {
generateBuildId: async () => {
return process.env.NEXT_EVENT_ENV === "prod"
? "XXXXXXXXXXXXXXX"
: "YYYYYYYYYYYYYYY";
},
....
}
def find_longest_homopolymer(seq):
if seq == None or seq == '':
return 0
polymer_lengths = []
curr_len = 0
polymer_nt = seq[0]
for nt in seq:
if nt != polymer_nt:
@matthewbordas
matthewbordas / MongoRegexQuery.js
Created March 13, 2019 22:04
Find object in MongoDB via Regex
/* This will perform a case insensitive search in the
* collection specified by 'CollectionName', against the field
* specified by 'targetField', for all strings in the field that contain
* the substring specified by 'substring'.
* This was tested primarily in the Mongo Shell.
*
* Source: https://stackoverflow.com/a/10610461/3559330
*/
db.getCollection('CollectionName').find({targetField: /substring/i})
/**
* Going to be testing 3 things:
* 1. Function marked async, but that still runs sync.
* 2. Function marked async and returns a promise, but that still runs sync.
* 3. Function marked async and that runs async by using process.nextTick().
*
* Note: async and sync are defined in the context of the Node.js event loop,
* which technically runs everything on one thread.
*
* Usage: this is a vanillaJS node script. So all you need to to do is type