Skip to content

Instantly share code, notes, and snippets.

View notify.rb
#!/usr/bin/env ruby
CHANNEL = "#shrug_bots"
SERVER = 'irc.freenode.net'
PORT = 6667
NICK = 'notify'
PASS = ''
require "socket"
View gist:296903
Stats for optimized parallel_specs spec-grouping.
Not much, but it's better.
Old sorting - Run #1
Process #1: Finished in 190.369665 seconds
Process #2: Finished in 196.368211 seconds
Real time: 3min 35sec.
Old sorting - Run #2
View schema_dumper bug?
Bug?
The SchemaDumper in rails, which is used by rake db:schema:dump expects there to be either a
"pk_and_sequence_for" or "primary_key" on the connection adapter. See line 82:
http://github.com/rails/rails/blob/master/activerecord/lib/active_record/schema_dumper.rb#L82
However... the jdbcmysql adapter does not have either method. The result of this is that running
"jruby -S rake db:schema:dump" will create a schema.rb where every table has :id => false.
View .autotest.rb
# .autotest in your project or ~/.autotest
# This reduces the time from when you save a file to when autotest runs the tests.
# Optimization: Quicker response time for the files you change more than once
class Autotest
alias_method :find_files_orig, :find_files
def find_files
result = {}
@recently_updated ||= []
View irssi build fail on snow leopard (brew)
...
/bin/sh ../../libtool --tag=CC --mode=link /Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -O4 -march=core2 -mmmx -msse4.1 -pipe -Wall -L/usr/local/Cellar/gettext/0.17/lib /private/tmp/homebrew-glib-2.20.5-VZb3/glib-2.20.5/iconv/lib/libiconv.a -framework Carbon -o buffered-input-stream buffered-input-stream.o ../../glib/libglib-2.0.la ../../gobject/libgobject-2.0.la ../../gio/libgio-2.0.la -lintl
libtool: link: /Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -O4 -march=core2 -mmmx -msse4.1 -pipe -Wall -o .libs/g-icon g-icon.o -L/usr/local/Cellar/gettext/0.17/lib /private/tmp/homebrew-glib-2.20.5-VZb3/glib-2.20.5/iconv/lib/libiconv.a ../../glib/.libs/libglib-2.0.dylib ../../gobject/.libs/libgobject-2.0.dylib ../../gio/.libs/libgio-2.0.dylib /private/tmp/homebrew-glib-2.20.5-VZb3/glib-2.20.5/gobject/.libs/libgobject-2.0.dylib /private/tmp/homebrew-glib-2.20.5-VZb3/glib-2.20.5/gmodule/.libs/libgmodule-2.0.dylib /private/tmp/homebrew-glib-2.20.5-VZb3/glib-2.20.5/glib/.libs/libglib-2.0.dylib -liconv -lintl -
View failures_during_run_formatter.rb
# http://gist.github.com/gists/593755 (fork of http://gist.github.com/485785)
require 'spec/runner/formatter/progress_bar_formatter'
class FailuresDuringRunFormatter < Spec::Runner::Formatter::ProgressBarFormatter
def example_failed(example, counter, failure)
super # show the 'F' in progress
dump_failure(counter, failure)
end
end
class Spec::Runner::Reporter
View Removing RI and RDOC
du -hs `gem env gemdir`/doc
# 465M /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/doc
sudo rm -r `gem env gemdir`/doc
echo 'gem: --no-ri --no-rdoc' >> ~/.gemrc
@joakimk
joakimk / livereload.rake
Created Nov 17, 2010
A simple rakefile to run livereload and generate css from the sass (scss) files specified in asset_packages.yml.
View livereload.rake
desc "Continuously watch for changes and rebuild files"
task :livereload do
pids = `ps ax|grep ruby|grep livereload|awk '{ print $1 }'`.split
other_pids = pids.reject { |pid| Process.pid == pid.to_i }
system "kill #{other_pids.join(' ')} &> /dev/null"
system "nohup livereload &> /dev/null &"
require 'rubygems'
require 'fssm'
@joakimk
joakimk / install.sh
Created Nov 21, 2010
Install script for Apache+REE+Passenger 3 on Ubuntu 10.04 64bit
View install.sh
# Install script for Apache+REE+Passenger 3 on Ubuntu 10.04 64bit
# BEFORE:
# - Make sure you are logged as a non-root user that can sudo.
# - Add your key here:
SSH_KEY="ssh-rsa ..."
# Add key to admin user
mkdir -p .ssh && echo "$SSH_KEY" >> .ssh/authorized_keys || exit 1
@joakimk
joakimk / quick_ruby_env.sh
Created Nov 24, 2010
Quickly installing a ruby environment on ubuntu that supports testbot
View quick_ruby_env.sh
sudo apt-get update && sudo apt-get install build-essential vim ruby ruby-dev libsqlite3-dev && wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz && tar xvfz rubygems-1.3.7.tgz && cd rubygems-1.3.7 && sudo ruby setup.rb && sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
You can’t perform that action at this time.