• Speed your builds way, way up in vue-cli 3.0 with AutoDllPlugin

    vue-cli 3.0 is in beta, and it’s pretty great! Our team wanted a zero-conf build tool for our vue projects so bad that a coworker actually created one. Now the community will be standardizing on one, and since it’s built on top of webpack the weird, fussy parts of our existing build process can be ported over without too much fuss.

    My favorite 3.0 feature, however, is off by default – and if your builds last longer than a few seconds, you should probably know about it, too. vue-cli 3.0 comes with built-in support for the autodll-webpack-plugin.

    If you’re really short on time, here’s the quick version:

    1. In your vue.config.js, do this:
    module.exports = {
      // other config goes here...
      dll: true
    }

    Seriously, just that. Your next build will be about the same speed as usual. Subsequent builds will be faster than usual – a lot faster. You can do even better, though…

    Read More
  • Actions Up, Data Sideways

    The rallying cry for Ember 2.0 has been “Data Down, Actions Up,” indicating a pattern wherein parents (routes/controllers, or high-level components) pass data “down” to child components, while children “request” changes from their parents by triggering actions. Doing things this way keeps parents from worrying about what their children do with data1, and children form worrying about how data is represented in their parents2.

    Expressed another way, DDAU is about keeping a nice, clean, abstractable API between parents and children. And that’s great, so long as that API stays simple, but, well…

    1. Well, they’ll worry anyway; that’s what parents do. But at least this way, their concerns will be largely unjustified. 

    2. In this metaphor, is an unexpected change to a bound value analogous to a parent dropping by a child’s place unannounced? 

    Read More
  • Introducing code_monkey

    A while back, I was working on an extremely tedious refactor on a huge Python codebase. I figure most people have hit something like this: a little too complicated for a find/replace, but painfully boring to write out by hand.

    I realized pretty quickly that I could describe the edits I wanted to make algorithmically – in that context, they were really, really simple. So I went looking for some scriptable Python refactoring tools, and found… well… not much. Rope, the most well-developed refactoring library for Python, still felt a little too heavy and complicated for the kind of quick one-offs I wanted to write. So, I took a stab at creating my own.

    Singer/songwriter/genius Jonathan Coulton wrote a great song honoring those who slog through boring, tedious coding work. So, I thought, what better name for a refactoring library than code_monkey?

    Read More
  • Messaging in Unity, pt. 2 (or, PubSub from scratch)

    In my previous post about using UnityEvents to communicate between Unity classes, I mentioned a problem with using events: the event objects need to be easily accessible from different classes. If you hang an event off of the class that uses it most heavily (say, putting a “fire” event on a Cannon), then you haven’t really solved the tight-coupling problem at all: you still need to find a Cannon whose fire event you want to trigger (or subscribe to). At that point, you might as well just call the method.

    Other frameworks and programming models have solved this problem by introducing a message “bus” – a central hub through which messages travel. By making the message bus widely accessible, you create a single (very, very simple) point of contact that disparate pieces of code can use to publish and subscribe to events. I decided to knock together a naive message bus implementation of my own. And given my caffeine-addled, sleep-deprived state, it actually turned out pretty well.

    Read More
  • Messaging in Unity (without SendMessage)

    Ludum Dare is a 48-hour solo game jam. Naturally, that means quick, dirty work. It is absolutely, positively, not the right time to be looking for elegant solutions to vexing technical design problems that could be solved temporarily with a handwave. You’d have to be absolutely insane to confront architecture woes on a two-day deadline. Very bad idea.

    You can probably tell where this is going.

    Read More
  • Ludum Dare 32 entry: Heel Face Turn

    I made a thing for Ludum Dare 32!

    Heel Face Turn

    Shoot enemies to turn them into allies, but be careful – you can only have one ally at a time, so converting another enemy turns your old ally against you! If your bullets hit other bullets, this will also cause your ally to revert to an enemy, because of Reasons.

    • WASD to move
    • Mouse to aim
    • Click to fire
    Read More
  • Django vs. ember-cli (and --proxy)

    Our new application at work is an Ember frontend backed by Django. To facilitate communication between Django and Ember, we’re using rest_framework_ember, which coerces the default JSON format of Django REST Framework into the JSON format expected by Ember. Early in development, I tried to serve my Ember app while proxying API calls to Django, using:

    ember serve --proxy http://localhost:8000
    

    and was surprised to get an error message (in Chrome) that looked like this:

    XMLHttpRequest cannot load http://localhost:8000/api/users/. No 'Access-Control-Allow-Origin'
    header is present on the requested resource. Origin 'http://localhost:4200'
    is therefore not allowed access.
    

    The problem turns out to have to do with trailing slashes, but is a little more subtle than it appears.

    Read More
  • Promise, but verify

    I’ve been writing tests for my Ember app recently, and had a bit of trouble figuring out how to test asynchronous behavior in my app. Cory Forsyth’s Demystifying Ember Async Testing proved very helpful in understanding how Ember’s built-in async test helpers work, but it stops just short of telling you how to hook into that behavior yourself. The following is my attempt to (very briefly) answer the question:

    In Ember, how do I write a test that depends on the resolution of a Promise?

    Read More
  • Ember: binding a read-only component property to a parent scope

    I spent a couple days trying to figure out why updates weren’t firing on one of my computed properties. Hopefully this saves somebody else the headache.

    I had a component for my project that looked something like this:

    Read More

subscribe via RSS