Skip to content

Instantly share code, notes, and snippets.

View svenfuchs's full-sized avatar

Sven Fuchs svenfuchs

View GitHub Profile
application@ext-con-sk-test $ ps aux | grep searchd
1002 24236 0.0 0.0 29380 876 ? S 15:05 0:00 searchd --pidfile --config /home/application/projects/s_k/staging/releases/20110210130306/config/staging.sphinx.conf
$ irb -rubygems >> require 'i18n'
=> true
>> I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
=> I18n::Backend::Simple
>> I18n.fallbacks.map(:eng => :en, :fin => [:eng, :en])
=> {:fin=>[:eng, :en], :eng=>:en}
>> I18n.fallbacks[:fin]
=> [:fin, :eng, :en]
>> I18n.fallbacks[:eng]
=> [:eng, :en]
@svenfuchs
svenfuchs / sender.rb
Created December 8, 2010 16:53
attach stdout to eventmachine
require 'rubygems'
require 'eventmachine'
class Sender < EventMachine::Connection
attr_reader :connection
def initialize
@connection = EM.connect('127.0.0.1', 9797)
end
@svenfuchs
svenfuchs / gist:730257
Created December 6, 2010 13:10
trying to fix arel 2.x in(subquery)
gems $ diff -r arel-2.0.6.orig arel-2.0.6.patched
diff -r arel-2.0.6.orig/lib/arel/predications.rb arel-2.0.6.patched/lib/arel/predications.rb
34c34
< Nodes::In.new self, other.to_a.map { |x| x.id }
---
> Nodes::In.new self, other
59c59
< Nodes::NotIn.new self, other.to_a.map { |x| x.id }
---
> Nodes::NotIn.new self, other
1) Error:
test_redirect_modulo(TestRoutingMapper):
ArgumentError: malformed format string - %{
/Volumes/Users/sven/Development/shared/rails/rails/actionpack/lib/action_dispatch/routing/mapper.rb:355:in `%'
/Volumes/Users/sven/Development/shared/rails/rails/actionpack/lib/action_dispatch/routing/mapper.rb:355:in `redirect'
/Volumes/Users/sven/Development/shared/rails/rails/actionpack/lib/action_dispatch/routing/mapper.rb:364:in `call'
/Volumes/Users/sven/Development/shared/rails/rails/actionpack/lib/action_dispatch/routing/mapper.rb:364:in `redirect'
/Volumes/Users/sven/.rvm/gems/ruby-1.8.7-p302/gems/rack-mount-0.6.13/lib/rack/mount/route_set.rb:148:in `call'
/Volumes/Users/sven/.rvm/gems/ruby-1.8.7-p302/gems/rack-mount-0.6.13/lib/rack/mount/route_set.rb:148:in `call'
/Volumes/Users/sven/.rvm/gems/ruby-1.8.7-p302/gems/rack-mount-0.6.13/lib/rack/mount/code_generation.rb:93:in `recognize'
Given state:
[x] Monitors
[ ] Printers
Form:
<input type="hidden" name="categorizations_attributes[id]" value="1">
<input type="hidden" name="categorizations_attributes[_destroy]" value="1">
~$ ARCHFLAGS='-arch i386 -arch x86_64'
~$ rvm install 1.8.7 --debug --reconfigure -C --enable-shared=yes
~$ wget http://sourceforge.net/projects/rubycocoa/files/RubyCocoa/1.0.0/RubyCocoa-1.0.0.tar.gz/download
~$ tar xzf RubyCocoa-1.0.0.tar.gz && rm RubyCocoa-1.0.0.tar.gz && cd RubyCocoa-1.0.0
~/RubyCocoa-1.0.0$ ruby install.rb config --build-universal=yes
~/RubyCocoa-1.0.0$ ruby install.rb setup
~/RubyCocoa-1.0.0$ sudo ruby install.rb install
require 'pathname'
# Bundler gemfile support for local/remote workspaces/repositories for work in
# development teams.
#
# Usage:
#
# # define paths to be searched for repositories:
# workspace '~/.projects ~/Development/{projects,work}'
#
# Include an anonymous module
#
# Useful for defining a class with a base module. So, instead of:
#
# class Foo
# module Base
# def bar
# # ...
# end
# end
require 'active_support/basic_object'
ActiveRecord::Base.class_eval do
class WithoutCallbacks < ActiveSupport::BasicObject
def initialize(target, types)
@target = target
@types = types
end
def respond_to?(method, include_private = false)