Skip to content

Instantly share code, notes, and snippets.

View chrismcg's full-sized avatar

Chris McGrath chrismcg

View GitHub Profile
## in test/test_helper.rb
class Test::Unit::TestCase
alias unlogged_run run
def run(result, &block)
RAILS_DEFAULT_LOGGER.debug "RUNNING #{self.class} #{@method_name}"
start_time = Time.now
unlogged_run result, &block
time = Time.now - start_time
RAILS_DEFAULT_LOGGER.debug "TIME;#{self.class}#{@method_name.gsub(/,/, '')};#{time}"
:javascript
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"))
:javascript
var pageTracker = _gat._getTracker("YOUR CODE");
pageTracker._setDomainName("YOUR DOMAIN");
pageTracker._initData();
pageTracker._trackPageview();
require 'rubygems'
require 'midiator'
require 'test/unit/ui/console/testrunner'
module Test
module Unit
module UI
module Midi
compile '*' do
case File.extname(item.attributes[:file].path)
when '.markdown'
filter :bluecloth
else
filter :erb
end
layout 'default'
end
This is basically a dirty hack :) I have no idea if messing with the default OSX apache config this way is frowned upon. My view is that it works now, and if it breaks I'll fix it.
Add any domains you want to blacklist to /etc/hosts, pointing at 127.0.0.1. You need to enable web sharing to get apache running of course.
Changes to the default /etc/apache2/httpd.conf
==============================================
Listen 127.0.0.1:80 # so that the world can't see the list
DocumentRoot "/Library/WebServer/Documents/public" # to fit in with passenger, you need to create the public dir (and maybe /tmp too)
require 'rubygems'
require 'ffi'
class Kurl
extend ::FFI::Library
ffi_lib 'libcurl'
CURLOPT_URL = 10002
CURLOPT_WRITEFUNCTION = 20011
CURLOPT_TIMEOUT = 13
function! Run_shitty_tests
silent exe "!truncate log/test.log"
let old_make = &makeprg
let test_command = "ruby -I <some libs> "
let &makeprg = test_command.expand("%")
exe "make!"
let &makeprg = old_make
endfunction
nnoremap <C-c>c :call Run_shitty_tests<cr>
" select at current indent level from http://vim.wikia.com/wiki/Visual_selection_of_indent_block
" modified for ruby to allow selecting the prev and next lines too for blocks
function! SelectIndent (blockmode)
let temp_var=indent(line("."))
while indent(line(".")-1) >= temp_var
exe "normal k"
endwhile
if a:blockmode == "yes"
exe "normal k"
end
chris@slinky % rvm install rbx
Installing pre-requisites
Downloading rubinius-1.0.0-rc5, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 8143k 100 8143k 0 0 155k 0 0:00:52 0:00:52 --:--:-- 160k
Extracting ...
Configuring rbx
Compiling rbx
Error running '/Users/chris/.rvm/bin/ruby-1.8.7-p249 -S rake install', please check /Users/chris/.rvm/log/rbx-1.0.0-rc5/rake*.log
chris@slinky % rvm list
rvm Rubies
jruby-1.3.1 [ [x86_64-java] ]
jruby-1.4.0 [ [x86_64-java] ]
jruby-1.5.0.RC3 [ [x86_64-java] ]
rbx-1.0.0-head [ ]
rbx-1.0.0-rc1 [ ]
ruby-1.8.6-p383 [ x86_64 ]