Publishing with React VR

  • Posted on: 17 March 2017
  • By: davis

Here are some steps you might have overlooked when publishing your React VR project for the first time.

Here's my first finished project:

1.) You have to upload the static_assets folder yourself - it's not included in the build folder.

2.) You need to modify your vr/build/index.html file to resemble this

<!-- When you're ready to deploy your app, update this line to point to your compiled client.bundle.js -->
    <script src="./build/client.bundle.js"></script>
      // Initialize the React VR application
        // When you're ready to deploy your app, update this line to point to
        // your compiled index.bundle.js
        // Attach it to the body tag

3.) Seriously, pay careful attention to the index.html file

Dropping All Connections From a Postgres DB

  • Posted on: 8 March 2017
  • By: davis

For Postgres 9.2 and above, here's how you can drop all active connections to your database. This is useful when you're trying to drop a table, but someone's still connected to it.

SELECT pg_terminate_backend( 
FROM pg_stat_activity 
WHERE datname = current_database() AND pid <> pg_backend_pid();

Importing Images in Electron React Boilerplate

  • Posted on: 11 February 2017
  • By: davis

You'll need to do a few things to properly import images in electron-react-boilerplate

First, create a directory under app/ to store your image files (e.g. app/img). Then drop your images in the folder.

Here's the correct (and only!) way to import images correctly in electron-react-boilerplate:

Building an LED Hula Hoop From Scratch

  • Posted on: 26 November 2016
  • By: davis

I'll save you a read if you don't care about details. Long story short - buy yourself a quality hoop from Hyperion. Save yourself the trouble of doing this, because frankly, the results we obtained were not that impressive. We spent around $800 in materials by the end of this project and ended up with a heavy, bulky, large, cumbersome hoop that broke after 10 minutes. Seriously - just get a good hoop from a pro.

Our final result, starring my girlfriend Amanda:


Fixing missing libssl library when using Django/Anaconda

  • Posted on: 16 November 2016
  • By: davis

Here's the fix for this error message on OSX: 

raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: dlopen(/Users/anaconda/lib/python2.7/site-packages/psycopg2/, 2): Library not loaded: libssl.1.0.0.dylib


Python: Capitalize First Letter of Each Word in a String (including after punctuation)

  • Posted on: 14 November 2016
  • By: davis

Python's str.title()  and string.capwords(str) methods have some flaws. Namely:

str = "my dog's bone/toy"
assert str.title() == "My Dog'S Bone/Toy"
assert string.capwords(str) == "My Dog's Bone/toy"

As you can see, str.title() doesn't quite format the string "Dog's" correctly - it instead opts to convert the "'s" to uppercase. This results in somewhat nonsensical strings.

string.capwords(str) is better about honoring the possessive case, but it has its own flaws. Firstly - it doesn't recognize words that occur after common punctuation like /, ( ), -, _, etc. This means that "bone/toy" will only be converted to "Bone/toy"

I've written my own answer to this problem, hopefully it helps anyone else who needs to capitalize the first letter of each word after punctuation without using title() or simply relying on capwords().

My solution first takes advantage of title() to solve most of the capitalization. It then uses a Regular Expression to look for an upper-cased letter preceded by a single quote mark that is in turn preceded by a lower-cased letter(this solves the issue of retaining contractions while matching single quotes within strings.)


Primitive Pics: A Really Cool Go Project

  • Posted on: 20 September 2016
  • By: davis

This is a really neat project that allows you to create cool photographs from your input.

A target image is provided as input. The algorithm tries to find the most optimal shape that can be drawn to minimize the error between the target image and the drawn image. It repeats this process, adding one shape at a time. Around 50 to 200 shapes are needed to reach a result that is recognizable yet artistic and abstract.

TypeError: Cannot read property 'timeout' of undefined with Mocha and Fat Arrow Syntax

  • Posted on: 12 July 2016
  • By: davis

Don't do this: 

describe('Do Something', () => {
  it(`Should do stuff successfully`, (done) => {
    // *this* binding refers to parent function scope in fat arrow functions
    // this will fail, no pun intended

    // do stuff here and include done() in the callback

Replace it with a normal function - fat arrow syntax will assign the "wrong" scope to timeout(), and you'll get an error like TypeError: Cannot read property 'timeout' of undefined

How I got the Shittalk Generator to 80kb pagesize

  • Posted on: 30 March 2016
  • By: davis

Lesson #1: Probably shouldn't have named it Shittalk Generator. It's hard to tell your family what it is. "Well... it's a script to shittalk people". Maybe I would have named it the Trash Talk Generator, in restrospect

You can track the actual commits I made on Github, you'll see the progression in pagesize.

Here are some notes:

Minify HTML (

[RELEASE] Bootstrap CRUD Generator

  • Posted on: 30 March 2016
  • By: davis

Go to the CRUD Generator

I'm pleased to announce that I've developed a Bootstrap CRUD application generator. Tired of manually building forms for basic SQL events? Use my tool to generate CRUD pages for your tables.

A painless way to create PHP/MySQL/Bootstrap CRUD apps

Generate a basic Bootstrap-themed CRUD (Create, Read, Update, Delete) application based on your MySQL SELECT, UPDATE, or CREATE query.