View licenses.ex
defmodule Mix.Tasks.Deps.Licenses do
alias Mix.Dep
use Mix.Task
@shell Mix.shell()
def run(_) do
Mix.Project.get!()
{with_licenses, without_licenses} =
View modalizer.js
import React, {Component, Children} from 'react'
import {connect} from 'react-redux'
const MODAL_CHANGE = 'MODAL_CHANGE'
// 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 = {}
CONTEXT_TYPES[CONTEXT_NAME] = PropTypes.func
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');
// 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.