View modalizer.js
import React, {Component, Children} from 'react'
import {connect} from 'react-redux'
// Maintain a single active modal identifier
export function modalReducer(state = {activeModalId: null}, {type, id}) {
if(type !== MODAL_CHANGE) {
return state
View reactUniqueId.js
import React, {Component, PropTypes, Children, createElement} from 'react'
const CONTEXT_NAME = '__uniqueIDFunction__'
const CONTEXT_TYPES = {}
function createUniqueIDFunction() {
let counter = 0
return function() {
return ++counter
View walkReactComponentFiles.js
'use strict'
const reactDocs = require('react-docgen')
const dir = require('node-dir')
export default function walkReactComponentFiles(path, pattern, handleFilename, done) {
const iterator = function(error, content, filename, next) {
if(error) {
throw error
View router.ex
# This plug takes HTML requests, forwards them to our controllers as JSON
# requests, takes the resulting JSON and POSTs it to a rendering service,
# then transforms the response back into HTML using the output from the
# rendering service.
# Which means we can write our probably-JavaScript/React view layer
# independently of Phoenix tooling.
defmodule ServiceRenderer do
# Base URL of render service goes here.
def init(url) do
View webpackProgrammaticConfig.js
var webpack = require('webpack');
var path = require('path');
var fs = require('fs');
var deepMerge = require('deep-merge');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
// Set up config merging function.
var merge = deepMerge(function(target, source, key) {
View mosquito-net.js
// Stupid JavaScript and console tricks.
// Trap and record console things and errors.
function MosquitoNet() {}
MosquitoNet.history = [];
MosquitoNet.writeHistory = function(type, args) {
MosquitoNet.history.push({ type: type, args: args });
MosquitoNet.shadowConsoleFunction = function(name) {
var oldFn = console[name];
View rack_reverse_proxy_by_adam.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
module MyProject
class Application < Rails::Application
View wordpress_controller.rb
require 'faraday'
class WordpressController < ApplicationController
@@wp_client = "http://#{ENV['WP_DOMAIN']}") do |builder|
builder.adapter Faraday.default_adapter
builder.headers = {'Content-Type' => 'application/json'}
builder.request :url_encoded
View every_controller_spec.rb
# What the heck is this spec about?
# It's a gut-check that runs against every controller in the application.
# It is NOT a replacement for writing controller specs for each controller.
# What this does is things like check to make sure you didn't forget to lock
# down the index action of a controller to authorized users, checks to see if
# common routes are throwing silly errors, etc.
# Your controller passing these tests does not guarantee that it is healthy.
View gist:850002bdcecefa355504
layout author title
Getting Good at Vim

I have used Vim to write code for about a year, and I can confidently say that Vim does two things for me well. The most obvious thing is that it cuts down on my text editing time. If you consider the amount of time you spend highlighting with the mouse and then returning back to the keyboard to edit text, daily, over the course of a year that time begins to adds up.