Skip to content

Instantly share code, notes, and snippets.

View joshuasiler's full-sized avatar

Joshua Siler joshuasiler

View GitHub Profile
@joshuasiler
joshuasiler / eventmachine.rb
Created November 4, 2011 02:42
Initializer that allows EventMachine to run within Rails, and work with AMQP, Passenger, Thin and Capybara
require 'amqp'
module HiringThingEM
def self.start
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
# for passenger, we need to avoid orphaned threads
if forked && EM.reactor_running?
EM.stop
end
Thread.new {
@joshuasiler
joshuasiler / gist:6782554
Created October 1, 2013 18:07
This is a patch to ExtJS bootstrap.js that allows it to work when frameworks include a refresh querystring with the js file (like bootstrap.js?12345). Since it appears to be nearly impossible to contribute to the ExtJS project, I've posted it here.
/*
This file is part of Ext JS 4.2
Copyright (c) 2011-2013 Sencha Inc
Contact: http://www.sencha.com/contact
GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as
published by the Free Software Foundation and appearing in the file LICENSE included in the
@joshuasiler
joshuasiler / gist:2379135
Created April 13, 2012 18:47
Jenkins shell script to run headless rails tests
# loads RVM into current shell for correct ruby and gem environment
source /etc/profile.d/rvm.sh
# source the .rvmrc file in the project
cd .
# instantiates an Xvfb session on display port 99
Xvfb :99 -ac &
# environment variable to let firefox know where to run
@joshuasiler
joshuasiler / robotButton.js
Created November 2, 2011 00:05
Javascript function that adds a little surprise to your HTML elements.
/* USAGE EXAMPLE
<style>
.example { padding:15px; border: 2px solid #888; width:100px;float:left;margin-left: 5px; font-size: 50px; margin-top: 50px; }
</style>
<div id="example1" class="example">1</div>
<div id="example2" class="example">2</div>
<div id="example3" class="example">3</div>
<div id="example4" class="example">4</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="/javascript/robotButton.js"></script>