Skip to content

Instantly share code, notes, and snippets.

View vitobotta's full-sized avatar

Vito Botta vitobotta

View GitHub Profile
@vitobotta
vitobotta / example.feature
Created June 4, 2012 21:32 — forked from matschaffer/example.feature
Cucumber - confirmation box with JavaScript
@javascript
Scenario: confiming when saving inactive
Given I expect to click "OK" on a confirmation box saying "Are you sure?"
When I press "Save"
Then the confirmation box should have been displayed
And I should see "TV" in the "Campaign Keywords" section
@vitobotta
vitobotta / config.ru
Created June 4, 2012 21:41 — forked from jlindsey/config.ru
Simplest rack app
require 'rack'
map '/' do
use Rack::Static, urls: ['/assets', '/templates'], root: File.expand_path('../public', __FILE__)
app = lambda do |env|
headers = {
'Content-Type' => 'text/html',
'Cache-Control' => 'no-cache'
}
@vitobotta
vitobotta / after.rb
Last active October 7, 2015 02:18 — forked from mperham/after.rb
Thread-friendly shared connection (e.g. for use with Capybara and some JavaScript drivers)
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || ConnectionPool::Wrapper.new(:size => 1) { retrieve_connection }
end
end
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
@vitobotta
vitobotta / gist:3303072
Created August 9, 2012 10:28
.rvmrc template
if (uname -a | grep '12.0.0 Darwin' >/dev/null); then
CC=/usr/bin/gcc-4.2 CPPFLAGS=-I/opt/X11/include rvm --install --create --disable-tcl --disable-tk use <ruby version>@<gemset name>
else
rvm --install --create --disable-tcl --disable-tk use <ruby version>@<gemset name>
fi
if ! which bundle >/dev/null; then
gem install bundler --pre --no-ri --no-rdoc && bundle install
fi
@vitobotta
vitobotta / external-command.rb
Created October 4, 2012 18:12 — forked from tokland/external-command.rb
Capture stderr data on EventMachine.popen
require 'rubygems'
require 'eventmachine'
$stdout.sync = true
$stderr.sync = true
EM.run {
EM.add_periodic_timer(0.1) {
$stdout.write "stdout\n"

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@vitobotta
vitobotta / gist:5231372
Last active December 15, 2015 08:29 — forked from cloud8421/install.sh
Installing latest tmux on Ubuntu
# libevent
cd /usr/local/src
wget https://github.com/downloads/libevent/libevent/libevent-2.0.20-stable.tar.gz
tar xvfz libevent-2.0.*-stable.tar.gz
cd libevent-2.0.20-stable/
./configure
make
make install
require 'rubygems'
require 'eventmachine'
require 'socket'
module RPCServer
include EM::P::ObjectProtocol
def post_init
@obj = Hash.new
end
def receive_object method

ruby-1.9.3-p392 cumulative performance patch for rbenv

(I guarantee nothing. No warranty I am not responsible blah blah blah. Seems to work great for me so far. Thanks to Tyler Bird who I forked this from.)

This installs a patched ruby 1.9.3-p392 with the railsexpress patchsets: https://github.com/skaes/rvm-patchsets

Requirements