Skip to content

Instantly share code, notes, and snippets.

View PragTob's full-sized avatar

Tobias Pfeiffer PragTob

View GitHub Profile
@PragTob
PragTob / shoes4_bouncing_ball.rb
Created August 17, 2013 17:45
I just quickly wrote a bouncing ball implementation in shoes4 as seen in the ruby-processing talk
Shoes.app title: 'bouncing ball' do
strokewidth 5
circle = oval 40, 40, 100
SPEED = 10
xspeed = SPEED
yspeed = SPEED
animate 30 do
xspeed *= -1 if circle.right >= width || circle.left <= 0
yspeed *= -1 if circle.top <= 0 || circle.bottom >= height
circle.move circle.left + xspeed, circle.top + yspeed
@PragTob
PragTob / JrubyShoesStacktrace
Created August 23, 2013 14:36
A stack trace from JRuby and Shoes with a refactoring of mine that doesn't seem to quite work ;-)
null:-1:in `error': java.lang.IllegalArgumentException: Argument not valid
from null:-1:in `error'
from null:-1:in `error'
from null:-1:in `setWidth'
from NativeMethodAccessorImpl.java:-2:in `invoke0'
from NativeMethodAccessorImpl.java:57:in `invoke'
from DelegatingMethodAccessorImpl.java:43:in `invoke'
from Method.java:616:in `invoke'
from JavaMethod.java:455:in `invokeDirectWithExceptionHandling'
from JavaMethod.java:316:in `invokeDirect'
@PragTob
PragTob / ErrorInstalling1.7.5.dev
Created September 9, 2013 19:48
Error installing jruby-1.7.5.dev
[2013-09-09 21:15:05] __rvm_ant
__rvm_ant ()
{
\ant "$@" || return $?
}
current path: /home/tobi/.rvm/src/jruby-head
command(2): __rvm_ant cext
Buildfile: /home/tobi/.rvm/src/jruby-head/build.xml
init:
@PragTob
PragTob / have_problem
Created September 26, 2013 23:06
weird have problem
++ 1380236645.608855020 /etc/profile : 4 > id -u
+ 1380236645.613815895 /etc/profile : 4 > '[' 1000 -eq 0 ']'
+ 1380236645.616452607 /etc/profile : 7 > PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
+ 1380236645.619365365 /etc/profile : 9 > export PATH
+ 1380236645.622064925 /etc/profile : 11 > '[' '' ']'
+ 1380236645.624657223 /etc/profile : 30 > '[' -d /etc/profile.d ']'
+ 1380236645.627298993 /etc/profile : 31 > for i in '/etc/profile.d/*.sh'
+ 1380236645.630077532 /etc/profile : 32 > '[' -r /etc/profile.d/bash_completion.sh ']'
+ 1380236645.633020828 /etc/profile : 33 > . /etc/profile.d/bash_completion.sh
++ 1380236645.635637206 /etc/profile.d/bash_completion.sh : 2 > '[' -z '4.2.45(1)-release' -o -z '' -o -n '' ']'
@PragTob
PragTob / second_try
Created September 27, 2013 05:42
export PS4="+ \$(__rvm_date \"+%s.%N\") \${BASH_SOURCE} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()} \${LINENO} > " ; bash -x -i -c "echo ok" 2>&1 | tee big.log
+ 1380260392.292606080 /etc/bash.bashrc : 7 > '[' -z '\s-\v\$ ' ']'
+ 1380260392.295774802 /etc/bash.bashrc : 11 > shopt -s checkwinsize
+ 1380260392.299199280 /etc/bash.bashrc : 14 > '[' -z '' ']'
+ 1380260392.302300697 /etc/bash.bashrc : 14 > '[' -r /etc/debian_chroot ']'
+ 1380260392.305450380 /etc/bash.bashrc : 19 > PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
+ 1380260392.308644944 /etc/bash.bashrc : 41 > '[' -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ']'
+ 1380260392.311726562 /home/tobi/.bashrc : 1 > for file in '/etc/bash_completion.d/*'
+ 1380260392.314402696 /home/tobi/.bashrc : 2 > source /etc/bash_completion.d/apt-file
++ 1380260392.317740256 /etc/bash_completion.d/apt-file : 1 > have apt-file
++ 1380260392.321349641 /etc/bash.bashrc : command_not_found_handle() 44 > '[' -x /usr/lib/command-not-found ']'
@PragTob
PragTob / gist:6735012
Created September 27, 2013 20:55
bundle install error
tobi@speedy:~/github/shoes4$ bundle
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Unfortunately, a fatal error has occurred. Please see the Bundler
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
TSort::Cyclic: topological sort failed: [#<Bundler::LazySpecification:0x49c095d1 @dependencies=[<Gem::Dependency type=:runtime name="rubyzip" requirements="< 1.0.0">, <Gem::Dependency type=:runtime name="shoes" requirements=">= 0">, <Gem::Dependency type=:runtime name="plist" requirements=">= 0">, <Gem::Dependency type=:runtime name="warbler" requirements=">= 0">], @name="furoshiki", @specification=nil, @platform="ruby", @source=#<Bundler::Source::Rubygems:0x4a323832 @fetchers={}, @installed_specs=#<Bundler::Index:0x135078 sources=[] specs.size=64>, @options={}, @caches=[#<Pathname:/home/tobi/github/shoes4/vendor/cache>, "/home/tobi/.rvm/gems/jruby-1.7.4@shoes/cache", "/home/tobi/.rvm/gems/jruby-1.7.4@globa
@PragTob
PragTob / gist:6735062
Created September 27, 2013 20:58
bundle env output
tobi@speedy:~/github/shoes4$ bundle env
Bundler 1.3.5
Ruby 1.9.3 (2013-05-16 patchlevel 392) [java]
Rubygems 1.8.24
rvm 1.22.9 (master)
GEM_HOME /home/tobi/.rvm/gems/jruby-1.7.4@shoes
GEM_PATH /home/tobi/.rvm/gems/jruby-1.7.4@shoes:/home/tobi/.rvm/gems/jruby-1.7.4@global
rubygems-bundler (1.3.3,1.1.1)
@PragTob
PragTob / breaks.rb
Created November 14, 2013 17:20
When a module (B) is included into another module (M) before that module is included into another class (A), everything works fine and the methods of the second module (B) are accessible. However if it is included after the original module (M) was included in the class (A), the method is not known.
module M
end
module B
def a
puts 'wuhuuu'
end
end
class A
@PragTob
PragTob / module_inclusion.rb
Last active December 28, 2015 08:39
Module inclusion not really dynamic in Ruby
module M ; end
module M2 ; end
class C
include M
end
M.send :include, M2
@PragTob
PragTob / shoes4-tb-crash
Created February 7, 2014 12:35
Shoes4 TB crash
tobi@big-one:~/github/shoes4$ bin/ruby-shoes testing/flow_append.rb
Fontconfig warning: "/etc/fonts/conf.d/53-monospace-lcd-filter.conf", line 10: Having multiple values in <test> isn't supported and may not work as expected
AfterDo::CallbackError: A callback block for method eval_block on the instance Shoes::Swt::Button with the following arguments: #<Proc:0x313b63e6@/home/tobi/github/shoes4/testing/flow_append.rb:3> defined in the file /home/tobi/github/shoes4/lib/shoes/swt/redrawing_aspect.rb in line 60 resulted in the following error: Java::JavaLang::IllegalArgumentException: Argument not valid and this backtrace:
org.eclipse.swt.SWT.error(Unknown Source)
org.eclipse.swt.SWT.error(Unknown Source)
org.eclipse.swt.SWT.error(Unknown Source)
org.eclipse.swt.graphics.TextLayout.setWidth(Unknown Source)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso