// from the flitter/orm project - src/filter/Filter.js/** * @module flitter-orm/src/filter/Filter */const Focus = require('./Focus')const FilterProxy = require('../proxy/model/FilterProxy')const { ObjectId } = require('mongodb')/** * An accumulating MongoDB filter object. * @class */class Filter {  /**   * The root query object.   * @type {object}   * @private   */  _root = {$and: []}  constructor(model) {    /**     * The model in question.     * @type: {module:flitter-orm/src/model/Model}     */    this._model = model  }  /**   * Clone this filter into a new filter instance.   * Ensures that modifications to the cloned filter do   * no affect this existing filter.   * @returns {module:flitter-orm/src/filter/Filter~Filter}   */  clone() {    const filter = new this.constructor(this._model)    filter.absorb(this._root)    return filter  }  /**   * Focus on a particular field.   * @param {string} field   * @returns {module:flitter-orm/src/filter/Focus~Focus}   */  field(field) {    return new Focus(this, field)  }  /**   * End the filter and apply it to the model's proxy.   * @returns {module:flitter-orm/src/proxy/model/FilterProxy~FilterProxy}   */  end() {    return new FilterProxy(this._model, this)  }  /**   * Asserts that a field must equal the value.// from the flitter/orm project - src/filter/Filter.js/** * @module flitter-orm/src/filter/Filter */const Focus = require('./Focus')const FilterProxy = require('../proxy/model/FilterProxy')const { ObjectId } = require('mongodb')/** * An accumulating MongoDB filter object. * @class */class Filter {  /**   * The root query object.   * @type {object}   * @private   */  _root = {$and: []}  constructor(model) {    /**     * The model in question.     * @type: {module:flitter-orm/src/model/Model}     */    this._model = model  }  /**   * Clone this filter into a new filter instance.   * Ensures that modifications to the cloned filter do   * no affect this existing filter.   * @returns {module:flitter-orm/src/filter/Filter~Filter}   */  clone() {    const filter = new this.constructor(this._model)    filter.absorb(this._root)    return filter  }  /**   * Focus on a particular field.   * @param {string} field   * @returns {module:flitter-orm/src/filter/Focus~Focus}   */  field(field) {    return new Focus(this, field)  }  /**   * End the filter and apply it to the model's proxy.   * @returns {module:flitter-orm/src/proxy/model/FilterProxy~FilterProxy}   */  end() {    return new FilterProxy(this._model, this)  }  /**   * Asserts that a field must equal the value.// from the flitter/orm project - src/filter/Filter.js/** * @module flitter-orm/src/filter/Filter */const Focus = require('./Focus')const FilterProxy = require('../proxy/model/FilterProxy')const { ObjectId } = require('mongodb')/** * An accumulating MongoDB filter object. * @class */class Filter {  /**   * The root query object.   * @type {object}   * @private   */  _root = {$and: []}  constructor(model) {    /**     * The model in question.     * @type: {module:flitter-orm/src/model/Model}     */    this._model = model  }  /**   * Clone this filter into a new filter instance.   * Ensures that modifications to the cloned filter do   * no affect this existing filter.   * @returns {module:flitter-orm/src/filter/Filter~Filter}   */  clone() {    const filter = new this.constructor(this._model)    filter.absorb(this._root)    return filter  }  /**   * Focus on a particular field.   * @param {string} field   * @returns {module:flitter-orm/src/filter/Focus~Focus}   */  field(field) {    return new Focus(this, field)  }  /**   * End the filter and apply it to the model's proxy.   * @returns {module:flitter-orm/src/proxy/model/FilterProxy~FilterProxy}   */  end() {    return new FilterProxy(this._model, this)  }  /**   * Asserts that a field must equal the value.

Hi, there.

My name is Garrett.

I'm a self-taught software developer and speaker.

Hi, there.

My name is Garrett.

I'm a self-taught software developer and speaker.

about me

Hi! My name is Garrett. Welcome to my little corner of the internet. I'm a self-taught developer and tech-nerd. I create software that I hope makes people's lives better. I created the Flitter web framework, and a couple other fun projects. I love to communicate my work, and help others pursue their projects, which is why I've got a long history of sharing about my passion. I write blog posts, create video tutorials, hold talks, and publish code from my projects in the hope that others will find it useful.

A bit more background: I grew up in the rural mid-west, so I taught myself everything I know. I'm a big fan of learning to code this way. I'm currently studying computer science at the University of Kansas.

about me

Hi! My name is Garrett. Welcome to my little corner of the internet. I'm a self-taught developer and tech-nerd. I create software that I hope makes people's lives better. I created the Flitter web framework, and a couple other fun projects. I love to communicate my work, and help others pursue their projects, which is why I've got a long history of sharing about my passion. I write blog posts, create video tutorials, hold talks, and publish code from my projects in the hope that others will find it useful.

A bit more background: I grew up in the rural mid-west, so I taught myself everything I know. I'm a big fan of learning to code this way. I'm currently studying computer science at the University of Kansas.

get in touch

I'd love to hear from you if you have questions or inquiries related to me or my projects. You can get in touch by text, e-mail, or using this form. I also tweet sometimes, and share thoughts on my blog.

E-Mail: shout@garrettmills.dev
Phone: (913) 730-7124

I'd love to hear from you if you have questions or inquiries related to me or my projects. You can get in touch by text, e-mail, or using this form. I also tweet sometimes, and share thoughts on my blog.

E-Mail: shout@garrettmills.dev
Phone: (913) 730-7124

what I've been up to

Open Letter

Open Letter

An Open Letter to Senator-elect Roger Marshall

Roger Marshall, Kansas Senator-elect, has expressed his intention to vote not to certify the result of the 2020 presidential election.

I feel very strongly that this is a dangerous and irresponsible move that goes against the core tenets of American democracy.

Read the letter here.

This letter is released in the public domain. Please, adapt it, share it with others, and most importantly, send it to your representatives. Call them, e-mail them, snail mail them to tell them to support free and fair elections.

permalink  |  1/2/2021, 11:30:31 PM

Code Snippet

Code Snippet

Full-text search PDFs from Linux CLI

For an open-note exam, I wanted a quick way to full-text search PDFs from the command-line.

I wrote a 2-line script to help with that, using just find, grep, and pdftotext (common to most distros).

Get it here.

permalink  |  12/9/2020, 1:35:36 AM

Side Project

Side Project

MiniQ: A bare-bones, CRON-driven job queue.

I wanted a simple way to queue jobs to be run in the background without having to run a separate daemon.

MiniQ is what I came up with. With just 3 files, MiniQ provides the ability to log jobs and the CRON script will run periodically and execute the queued jobs in the background.

More info here.

permalink  |  12/2/2020, 7:51:45 PM

Blog Post

Blog Post

Converting an Ionic/Angular Site into a Progressive Web App

For the last year or so, I've been working on converting an Ionic app to a progressive web app with offline support called Noded. I decided to write up my findings on how to do this with Angular service-worker.

Read more about it here.

permalink  |  12/1/2020, 6:28:31 PM

Side Project

Side Project

My Technical Notes Site

I'm trying to write down or save all the technical tricks, notes, and fixes I find. That way, it's easier for me to find them again in the future, and maybe they can be of use to others.

You can check them out here.

permalink  |  11/29/2020, 9:13:30 AM

Code Release

Code Release

VuES6 - ES6 Vue.js Components, in Plain JavaScript

I recently released a small utility library for defining Vue components as proper ES6 classes, but in vanilla JavaScript. I like to use this in small projects where I don't want to have to set up vue-cli and compile templates. More info here.

permalink  |  4/22/2020, 11:17:15 PM

Garrett Mills
Copyright © 2021 Garrett Mills