Skip to content

Instantly share code, notes, and snippets.

View mutle's full-sized avatar

Mutwin Kraus mutle

View GitHub Profile
# no maint page unless migrations are required
def conditionally_enable_maintenance_page
if c.migrate?
info "~> testing necessity for migrations & maintenance page"
if `cd #{c.release_path} && bundle exec rake db:migrate:status | grep down | wc -l`.to_i > 0
info "~> migrations pending, maintenance page required"
super
else
" Use 2 soft-tabs
set softtabstop=2
set shiftwidth=2
" Use spaces not tabs
set expandtab
require 'actor'
require 'http'
require 'http/socket'
class ServerActor
attr_accessor :app
def initialize(app)
@app = app
@actor = Actor.new do
begin
@mutle
mutle / GDB Output
Created March 27, 2011 16:13
Rubinius FFI Callback deadlock
(gdb) bt
#0 0x00007fff8471cf8a in __semwait_signal ()
#1 0x00007fff84720da1 in _pthread_cond_wait ()
#2 0x0000000100028632 in rubinius::GlobalLock::take (this=0x101006208) at thread.hpp:405
#3 0x000000010013a35e in rubinius::NativeFunction::call (this=0x101a3ad60, state=0x100f06280, args=@0x7fff5fbfb580, msg=<value temporarily unavailable, due to optimizations>, call_frame=0x7fff5fbfb630) at vm/builtin/nativefunction.cpp:1013
#4 0x000000010013b197 in rubinius::NativeFunction::execute (state=0x100f06280, call_frame=0x7fff5fbfb630, msg=@0x102e5bcf0, args=@0x7fff5fbfb580) at vm/builtin/nativefunction.cpp:86
#5 0x00000001000375a0 in rubinius::VMMethod::interpreter (state=0x100f06280, vmm=0x102ea9960, call_frame=0x7fff5fbfb630) at instruction_implementations.hpp:526
#6 0x0000000100115e1f in rubinius::VMMethod::execute_specialized<rubinius::OneArgument> (state=0x100f06280, previous=0x7fff5fbfba90, msg=@0x10143b500, args=@0x7fff5fbfb9e0) at vm/vmmethod.cpp:615
#7 0x0000000100120cdb in rubinius::CompiledMetho
➜ rvm use jruby
Using /Users/mutle/.rvm/gems/jruby-1.5.6
mutle at mutle in ~
➜ gem install rdiscount
Building native extensions. This could take a while...
ERROR: Error installing rdiscount:
ERROR: Failed to build gem native extension.
/Users/mutle/.rvm/rubies/jruby-1.5.6/bin/jruby extconf.rb
WARNING: JRuby does not support native extensions or the `mkmf' library.
require File.expand_path('../spec_helper', __FILE__)
describe "Class#class_eval" do
it "uses the right variable scope for class variables declared in class_eval" do
module ClassAttribute
class << self
def included(mod)
mod.class_eval <<-EOS
unless defined? @@attribute
@@attribute = nil
@mutle
mutle / 1
Created February 5, 2011 22:16
➜ cat test_cattr_accessor.rb
require 'rubygems'
require 'active_support/all'
class A
cattr_accessor :attribute
end
class B
cattr_accessor :attribute
#!/bin/sh
kill `ps uax | grep Finder | awk '{print $2}' | head -n 1`
(mutle@mutle) ~/Programming/redcursor/redpress <ruby1.9> (rbx-1.0.1-20100603)
→ be rake test:ci --trace
error loading "/Users/mutle/.bundle/rbx/1.8/gems/yard-0.5.3/lib/rubygems_plugin.rb": Tried to use object of type String (51) as type Array (6) (TypeError)
(in /Users/mutle/Programming/redcursor/redpress)
WARNING: Could not find a good alternative for performing time outs -- connecting to Redis will not time out. Try installing the SystemTimer gem.
rake aborted!
Tried to use object of type String (51) as type Array (6)
/Users/mutle/.bundle/rbx/1.8/gems/BlueCloth-1.0.1/lib/BlueCloth.rb:3:in `__script__'
kernel/common/codeloader.rb:145:in `require'
kernel/common/kernel.rb:693:in `require'
cache_settings = YAML.load_file("#{BLOG_BASE_PATH}/config/memcached.yml")["defaults"]
config.cache_store = :mem_cache_store, cache_settings['servers'], cache_settings
config.action_controller.session = {
:memcache_server => cache_settings['servers'],
:namespace => "#{Rails.env}:session",
:expire_after => 5.days
}
config.action_controller.session_store = :mem_cache_store