Victor Quinn

Law degree toting, motorcycle riding, craft brew loving application architect, problem solver, modern day renaissance man. Building SocialRadar.

Read this first

Full text search with Bookshelf.js

I have a table with a MySQL full text index and wanted to search it with Bookshelf.js. bookshelf.png There is actually an open issue to add full text index support to Knex, the query building underlying Bookshelf, but it hasn’t been implemented yet.

Bookshelf has no inbuilt method for performing such a query but it actually ended up being rather simple.

Assuming you have a valid Bookshelf model configured already, for example:

var Customer = Bookshelf.model.extend({ tableName: 'customers' }); 

(lifted verbatim from the Bookshelf docs)

Let’s say the customer has a bio field on which you’d like to perform a full text search. You can do so with the following syntax:

var searchTerm = <code to build your search term> var customer = new Customer() .query("whereRaw", "MATCH (bio) AGAINST(" + searchTerm + ")") .fetch(); 

And that’s it!...

Continue reading →


Spin

sOHigMevCPvRite4DMg5mKZPVp86gkXttLWDX78s3jU.png

First I want to say that I’m excited about the Amazon fireTV. It looks like a very cool product!

But I was struck by a handful of observations of major spin, particularly with their comparison chart, copied above. 1

  1. iTunes - Their biggest omission. Interesting how under Popular Services, iTunes is entirely omitted. I have no hard numbers, but I’m fairly certain iTunes is one of the most popular services for viewing both video and audio yet it’s omitted entirely on this chart. This is a major reason I have traditionally recommended an AppleTV to family and friends when they ask which box to buy. I’m rather surprised they even put HBO GO on the comparison, perhaps in an attempt to seem trustworthy by not only showing capabilities the fireTV has which its competitors don’t? 2
  2. Airplay - Another major feature the AppleTV has which the Fire doesn’t. Of...

Continue reading →


Mike Judge’s Silicon Valley…

…is the next in a long list of excellent shows I will not watch as they air due to HBO’s draconian digital rights management.

It is absurd that in 2014, I cannot, for any amount of money, view this show (legally) without signing up for a cable subscription, something I will not do.

I have money, they have content, the fact that HBO continues to fight this silly battle and prevent me from giving them my money in return for their content is absurd.

Early reviews sound great, the show sounds exciting and interesting and super relevant since I work at a startup but sadly I’m going to have to wait a year or more until HBO allows me to pay them to watch it.

Continue reading →


Desired: Oculus Rift as a monitor replacement

Just read Wired article Oculus Is Awesome for Games, But It’s the Future of Movies

I had an idea I haven’t been able to shake since I first used an Oculus:

I want an Oculus Rift instead of monitors for programming.

I want to arrive at work and be able to sit in a chair which has a keyboard and trackpad mounted on it (perfectly ergonomically oriented to suit my body of course) and to be able to spin 360 degrees and be encircled by two dozen virtual screens which I can see simply by rotating my chair and head just as I do now with my 3 screens in the real physical world.

Arguably I could dispense with physical motion entirely, but I think it’s still faster and easier to just turn my head or my chair to switch between buffers than any other method, for the same reason I find myself far more productive with two monitors or three than with just one (for now at least!)....

Continue reading →


JavaScript: Async Promise “while loop”

This is a solution to the situation where you have an asynchronous task you want to perform over and over again, in a non-blocking fashion, stopping when some condition is met.

To set the stage, I’ll be using the Bluebird Promise library, the best Promise library I’ve used.

First, we’ll construct the Promise function which will do the looping:

var Promise = require('bluebird'); var promiseWhile = function(condition, action) { var resolver = Promise.defer(); var loop = function() { if (!condition()) return resolver.resolve(); return Promise.cast(action()) .then(loop) .catch(resolver.reject); }; process.nextTick(loop); return resolver.promise; }; 

It receives 2 arguments, both expected to be functions:

  1. condition - This is a predicate function which shall return true or false and indicate whether the end state has been reached. true if done, false otherwise.
  2. ...

Continue reading →


Great Programmer Font

I’ve been using Menlo for a few years now and before that it was Monaco.

But I’m always on the search for things that will make my setup better.

This new open source font, Cosmic Sans Neue Mono looks like it may be my new favorite.

vim21.png

It’s monospaced so it’s good for programming, but it feels a bit more playful and fun than either Menlo or Monaco.

Time will tell if it sticks, but I’m digging it thus far!

Continue reading →


Thoughts on Opera Next

I have been using Opera Next 18.0 as my primary browser for the past few weeks. This is the first version of Opera with the guts of Chromium.

icon-opera-next-2013.png

I should mention, for the unfamiliar, Opera Next is essentially the Beta version of the Opera browser. It is pre-release software and thus not fully complete yet. Chrome has a similar beta build called Canary.

So please understand that I’m discussing a not entirely finished product. My thoughts:

1. Blink (very good)

One of my motivators for trying it out is that under the hood Opera Next is now using Blink, the rendering engine Google forked from Webkit.

I’ve used Opera as my main browser in the past, but usually ended up moving back to Safari or Chrome because its own Presto rendering engine tended to be a bit quirky. No more.

With Blink they’re literally using the same engine as Chrome so those quirks are a thing of the...

Continue reading →


Emacs: Prevent autosave mess

Emacs will create backup files for you. By default, it will do so after every 300 characters you type. 1

It does so by creating a new file with the same filename as the one you were editing, but wrapping it in # characters.

So if you were editing mycoolfile.js, after changing 300 characters, you’d have a file named #mycoolfile.js# in that same directory.

This can get really annoying when dealing with version control.

Here are a few methods of dealing with those files to make things a bit more manageable:

1. Add [#]*[#] to your global .gitignore file

You can do it on per repository basis, and that works, but only for the specific repo you added it to.

A better solution is to create a global .gitignore file and add
[#]*[#] to that file so they are ignored globally by git.

To do so, create a global .gitignore file (if you don’t have one already):

git config --global...

Continue reading →


Accent Color

Or, a tale in which one nerd spends far too long picking a Color for his blog with journeys into some fun bits of hexadecimal numbers, math, and programming.

Joining Svbtle

I recently joined the ranks of Svbtle with this blog.

I did so for many reasons, but here are the highlights:

  • I’ve long been a big fan of Dustin Curtis and his design chops
  • I got tired of maintaining my own blog
  • My old blog was in Jekyll which made editing it on a smartphone a no go
  • I find the design clean and brilliant
  • I tried a handful of others and this was my clear favorite

Thankfully, Svbtle takes care of most things for me, with choices I would have made myself.

The one main decision left to me for the look and feel was my Accent Color and I wanted to choose a great, unique one.

Vibrant Colors

Anyone who knows me well knows I’m a huge fan of vibrant colors. I ride a bright yellow motorcycle, the...

Continue reading →


Gobbledygook: a poem

Gobbledygook, gobbledygook,
Here I sit with my head in a book,
The pages have words and numbers and stuff,
But somehow I wish they weren’t so tough.

So quantum mechanics here I come,
With all of my smart and none of my dumb!

written in Fall 2003 when I was first studying Quantum

Continue reading →