Josh Thompson     About     Archive

Finding an Edge

These last two weeks have been the hardest, or the most frustrating, of my time at Turing so far.

I’ve been put a little off-balance by this difficulty, and I think I’m close to uncovering some useful tidbit or idea that will serve me well, and might serve someone else too.

Several different people warned me that

Mod 3 is just like mod 1 in terms of difficulty

I wasn’t sure what to make of that, because Mod 1 wasn’t too bad of a struggle. I think I gave myself a bad case of the “mismatched expectations”.

>> Read more

On Cleaner Controllers

A few days ago, I worked on a project that was mostly about serving up basic store data (modeled after Etsy) to an API.

We had a few dozen end-points, and all responses were in JSON.

Most of the action happened inside of our controllers, and as you might imagine, our routes.rb file was bananas.

One of the instructors made an exceptionally simple suggestion, I was embarrassed to not have seen it.

It was about nesting our controllers a bit better.

For context, here’s our routes for our merchants objects, relationships, and analytics:

Rails.application.routes.draw do
  namespace :api, defaults: {format: :json} do
    namespace :v1 do
      resources :merchants, only: [:index, :show], :controller => "merchants/merchants" do
        get "items", to: "merchants/merchant_items#index"
        get "invoices", to: "merchants/merchant_invoices#index"
        get "customers_with_pending_invoices", to: "merchants/merchant_pending_customers#index"
        get "favorite_customer", to: "merchants/merchant_favorite_customer#show"
        get "revenue", to: "merchants/merchant_revenue#show"
        collection do
          get "most_items", to: "merchants/merchants_most_items#index"
          get "most_revenue", to: "merchants/merchants_most_revenue#index"
          get "revenue", to: "merchants/merchants_revenue#show"
          get "find", to: "merchants/merchants_find#show"
          get "find_all", to: "merchants/merchants_find#index"
          get "random", to: "merchants/merchants_random#show"
        end
      .
    .
  .
>> Read more

Tour of D3 for Clueless Folk Like Me

D3 stands for Data Driven Documents, and it’s the coolest thing ever.

Check out a few examples:

So, this is the kind of stuff you can do with D3. The Front-end track at Turing gave a short lesson on D3, and I was one of two back-end folks participating. This was actually really encouraging, because they didn’t know much about d3 either.

So, lets dig into D3 a bit, and do two things:

  1. Get a running d3 map running locally (we’re gonna use circle wave)
  2. Deconstruct a simple d3 project to it’s minimum components, expecting that we’ll learn something along the way.
>> Read more

Playing with the HTTP send/response cycle in Ruby, without Faraday

note (that’s me): I’ve written a lot over the last few months of Turing, but my list of public gists is getting so long I can barely keep track of it. So, as I write longer things that I think might be useful to others (especially Turing students) I’m going to stick it here. If you’re not interested in Turing or programming, it’s safe to skip this particular post. D3 stands for Data Driven Documents, and it’s the coolest thing ever.

Check out a few examples:

So, this is the kind of stuff you can do with D3. The Front-end track at Turing gave a short lesson on D3, and I was one of two back-end folks participating. This was actually really encouraging, because they didn’t know much about d3 either.

So, lets dig into D3 a bit, and do two things:

  1. Get a running d3 map running locally (we’re gonna use circle wave)
  2. Deconstruct a simple d3 project to it’s minimum components, expecting that we’ll learn something along the way.

Note to the reader: I know _almost nothing about frontend tools. If you’re comfortable on the front-end, bear with my ignorance. If you, too, know nothing about the front-end, great! This should be at your level._

Running circle-wave locally

  • you’ll need a text editor and a browser. I’m using Chrome and Atom.
  • you’ll need to be able to open up various files on your computer in Chrome and your text editor. My tool of choice is the command line + iterm + zsh.

First, have a folder you can stick this all in. I’ve got /d3/circle-wave/

>> Read more

Streets in Asheville

Quick-and-dirty street analysis in Asheville, NC

A few months ago, I visited Asheville, NC. It's a nice town, and has a great pedestrian life, as far as I can tell.

As a thought experiment, I decided to see how well I could make the case for reducing the road width of a few streets.

The reasons are simple - wide roads are hard to cross by pedestrians, encourage faster driving, and are (as I'm going to try to prove) bad for cities.

It's common for "walkable" streets to have two wide lanes traffic (one each way) plus a lane for parking on each side, plus, perhaps, one or two bicycle lanes, and perhaps a small buffer between traffic going each way.

This seems like a tolerable idea, except it means all of a sudden your little road is difficult to cross.

I'll be examining 45-61 W Walnut St, Asheville, NC:

Pictures are of these streets Pictures are of these streets

There's a few lenses that you can evaluate these streets for:

  • Car-friendly
  • Pedestrian-friendly/bike-friendly
  • Financial implications for city
  • Financial implications for businesses

Lets take a quick stab at each of these:

For cars

This street/road is very drivable. Here's the intersection looking north:

green for cars, yellow for bikes green for cars, yellow for bikes >> Read more