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');
// BEGIN CONFIG TOOLS
// 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.
Bundler.require(*Rails.groups)
module MyProject
class Application < Rails::Application
View wordpress_controller.rb
require 'faraday'
class WordpressController < ApplicationController
@@wp_client = Faraday.new(url: "http://#{ENV['WP_DOMAIN']}") do |builder|
builder.adapter Faraday.default_adapter
builder.headers = {'Content-Type' => 'application/json'}
builder.request :url_encoded
end
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
post
edward
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.

View barcamp_overlay.html
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
html {
background-image: url(http://www.barcampnola.com/images/splash.jpg);
background-size: cover;
}
body {
padding: 0;
View gist:5832216
var sys = require('child_process');
function commandExists(cmd) {
var exists = false;
sys.exec(cmd, function(err) {
if(err === null) // of maybe: if(!err instanceof Error)
exists = true;
});
View gist:4252663
error: Error running command start
error: Nodejitsu Error (500): Internal Server Error
error: There was an error while attempting to deploy the app
error:
error: tar exited with code: 2
error: Error output from Haibu:
error:
error: Error: tar exited with code: 2
error: at ChildProcess.Tar.init (/root/haibu-orchestra/node_modules/haibu/lib/haibu/repositories/tar.js:58:26)
error: at ChildProcess.EventEmitter.emit (events.js:91:17)
View mongoose-single-subdoc.js
// mongoose doesn't like single embedded schemas
// it likes them as arrays of an embedded schema
// so this is a cheater hack to fake a single subdoc
// it creates a field named `_yourField` and a virtual named `yourField`
// and it makes sure the array keeps just one element in it
// USAGE EXAMPLE:
/*
var models = require('models')
, ChildSchema = models.ChildSchema
, singleSubdoc = require('mongoose-single-subdoc');