Skip to content

Instantly share code, notes, and snippets.

View pcockwell's full-sized avatar

Patrick Cockwell pcockwell

  • Freefall Consulting Inc.
  • Phuket, Thailand
View GitHub Profile
@pcockwell
pcockwell / gist:5588810
Created May 16, 2013 01:43
Windows Apache Config
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
@pcockwell
pcockwell / parallel_helper.rb
Last active August 29, 2015 14:27
Using Parallel with an ActiveRecord Generator
require 'parallel'
###############################################################
# Blocks run via Parallel will block on the completion
# of all threads or processes before continuing afterwards
module ParallelHelper
def process_in_batches_with_threads(enumerable, num_threads, &block)
# Even out batches as much as possible between each thread
batch_size = (enumerable.size.to_f / num_threads.to_f).ceil

Keybase proof

I hereby claim:

  • I am pcockwell on github.
  • I am pcockwell (https://keybase.io/pcockwell) on keybase.
  • I have a public key ASBZb3xYy2OoatNs47sjucqNTnznhYarApmgc1XVG4KwXQo

To claim this, I am signing this object: