Skip to content

Instantly share code, notes, and snippets.

View johnthethird's full-sized avatar

John Lynch johnthethird

View GitHub Profile
@johnthethird
johnthethird / cap_notify.rb
Created May 4, 2011 20:02 — forked from rtekie/cap_notify.rb
Capistrano deployment email notifier for Rails 3
=begin
Capistrano deployment email notifier for Rails 3
Do you need to send email notifications after application deployments?
Christopher Sexton developed a Simple Capistrano email notifier for rails. You can find details at http://www.codeography.com/2010/03/24/simple-capistrano-email-notifier-for-rails.html.
Here is Rails 3 port of the notifier.
The notifier sends an email after application deployment has been completed.
@johnthethird
johnthethird / customdomain.rb
Created September 23, 2011 22:23 — forked from dwabnitz/customdomain.rb
rack middleware to resolve a custom domain to an original subdomain in a multi-tenant application
require 'net/dns/resolver'
# Custom Domain
#
# Require net-dns gem
#
# A Rack middleware to to resolve the custom domain to original subdomain
# for your multi telent application.
#
# It's all transperant to your application, it performs cname lookup and
@johnthethird
johnthethird / server.log
Created December 3, 2011 03:37
Torquebox error: (LoadError) library `fcntl' could not be loaded: java.lang.NullPointerException
## SOLUTION
I was able to get past the error by putting this line at the top of config/application.rb
require 'fcntl'
##
torquebox-2.0.0.beta1
$ uname -a
Darwin JohnsAir.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64
@johnthethird
johnthethird / error.log
Created December 5, 2011 23:09
uninitialized constant TorqueBox::Infinispan::Cache::TransactionMode
vcloud@Master1:~/kaleo-current$ bundle exec rails c --trace
NameError: uninitialized constant TorqueBox::Infinispan::Cache::TransactionMode
vcloud@Master1:~/kaleo-current$ RAILS_ENV=production rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/home/vcloud/torquebox-current/jruby/bin/jruby /home/vcloud/torquebox-current/jruby/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
@johnthethird
johnthethird / Execscripts.coffee
Created March 11, 2012 18:21
Batman binding for executing script blocks in views
# Execscripts.coffee
# John Lynch / Rigel Group, LLC
# Open source under the MIT License.
#
# Create a new binding that marks a specific node as having children scripts blocks, and then executes those script
# blocks as soon as the node has been added to the DOM by Batman. (This is necessary as many jQuery-type plugins
# wont work if run on an isolated node before it has been added to the DOM.)
#
# (Thanks to SO for some of this code. http://stackoverflow.com/questions/220188/how-can-i-determine-if-a-dynamically-created-dom-element-has-been-added-to-the-d)
#
######################
#
# ActiveRecord's ConnectionPool in Rails 3.2.3 allows threads to 'steal'
# connections from each other, so some threads get starved out.
#
# This monkey patch uses an implementation from https://github.com/rails/rails/pull/6492
# that ensures 'fair' queue in ConnectionPool.
#
# It's actually a weird hybrid which ALSO maintains the clear_stale_cached_connections!
# behavior to reclaim leaked orphaned connections, and calls that method
@johnthethird
johnthethird / ie8.html
Created June 9, 2012 20:54
IE8 Batman Performance
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<title>Batman Profiler</title>
<script type="text/javascript" src="https://raw.github.com/Shopify/batman/master/lib/es5-shim.js"></script>
<script type="text/javascript" src="https://raw.github.com/Shopify/batman/v0.9.0/lib/batman.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js"></script>
<script type="text/javascript" src="http://coffeescript.org/extras/coffee-script.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
@johnthethird
johnthethird / AnimationTest.html
Created June 12, 2012 04:59
Animation Test for Batman.js
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<title>Batman Animate</title>
<script type="text/javascript" src="https://raw.github.com/Shopify/batman/master/lib/es5-shim.js"></script>
<script type="text/javascript" src="https://raw.github.com/Shopify/batman/v0.9.0/lib/batman.js"></script>
<script type="text/javascript" src="http://coffeescript.org/extras/coffee-script.js"></script>
<style>
p {
font: 12px/16px Arial;
@johnthethird
johnthethird / parallel_asset_compiler.rb
Created August 3, 2012 16:05 — forked from brentd/parallel_asset_compiler.rb
Parallelize assets:precompile
require 'parallel' # gem install parallel (https://github.com/grosser/parallel)
# Monkey patch to Sprockets::StaticCompiler, a class provided by actionpack
# that's used by the assets:precompile task. This patch uses the Parallel gem
# to parallelize asset compilation in the simplest way possible.
#
# Parallel wraps Process.fork to handle things like inter-process communication
# via pipes and determining the maximum number of processes to run based on
# your system's total logical processors. So far only tested on MRI 1.9.3 on OS X.
module Sprockets
@johnthethird
johnthethird / new_bashrc.sh
Created August 11, 2012 14:09 — forked from josephwecker/new_bashrc.sh
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful.
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
# Are you tired of trying to remember how darwin/mac-osx treat them differently from linux?
# Are you tired of not having your ~/.bash* stuff work the way you expect?
#
# Symlink all of the following to this file:
# * ~/.bashrc